Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
tanphat1412
Posts: 125
Registered: ‎11-06-2012
My Device: BlackBerry
My Carrier: Mobifone
Accepted Solution

Need help about Notification Dialog

I'm currrently have some trouble with the notification dialog:- I can't figure out how to connect the signal of SystemUiButton - are appended to notification dialog in Qt code, I have two button on the dialog.

- Is there a way to disable the sound and led notification when the dialog show?

 

Thanks foe helping

Please use plain text.
Developer
jalue
Posts: 196
Registered: ‎03-04-2013
My Device: BB Z10
My Carrier: Rogers

Re: Need help about Notification Dialog

[ Edited ]

Are you only using QML?  Did you check the Sample App for Notifications in the Platform list here?

https://developer.blackberry.com/cascades/sampleapps/

 

If you're using QML:

You'd use onFinished: { } for the NotificationDialog that you specify in the attachedObjects area to get the signal...

 

    onFinished: {
if (result == 2)
console.log("SUI: " + notificationDialog.buttonSelection().label)
}

 To see which button was selected according to the label you provided...

 

If you're using C++:

Connect the signal with a member variable you declare for the NotificationDialog and:

// Be sure to include the SystemUiButton and NotificationResult stuff
#include <bb/system/SystemUiButton>
#include <bb/platform/NotificationResult>
...
...

    bool res = connect(myNotDialog,
          SIGNAL(finished(bb::platform::NotificationResult::Type),
          this,
          SLOT(onFinished(bb::platform::NotificationResult::Type)));
    Q_ASSERT(res);
    Q_UNUSED(res);

// In your SLOT function you would check the result...

void myClass::onFinished(bb::platform::NotificationResult::Type result)
{
    if (result == NotificationResult::ButtonSelection) {
        if (myNotDialog->buttonSelection()->label() == "Okay") {
            // User clicked Okay
            // And you check any other button labels you have..
} } }

 

Not 100% sure, but that is the idea...

 

--Edit--

Used the wrong include areas...

 

Also, I'm not entirely sure you can disable the notification stuff within your app. I know the user can within Settings -> Notifications ... but obviously that doesn't help you much.. .. You can try to use the resetCategory() function which sets it to a QString::null, which means no category.. Not entirely sure if that is how it's done..

 

And perhaps using setSoundUrl(""); but not sure if it would give an error...

Please use plain text.
Developer
tanphat1412
Posts: 125
Registered: ‎11-06-2012
My Device: BlackBerry
My Carrier: Mobifone

Re: Need help about Notification Dialog

setSoundUrl("") is not working. But it's no problem now.

Thank you so much for your help.

Please use plain text.
Regular Contributor
martinwang
Posts: 84
Registered: ‎12-02-2009
My Device: Not Specified

Re: Need help about Notification Dialog

do you find the solution
Please use plain text.