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

Java Development

Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.

Posts: 62
Registered: ‎05-29-2009
My Device: Not Specified

NotificationListener and Deferred Events

I'm writing and application that has two processes - a backend process that runs all the time that retrieves data from a server, and a frontend GUI that may not be running all the time.  The backend may hit errors that it needs to notify the user about.  Rather than roll my own inter-process queuing method I saw NotificationListener and deferred events with the NotificationsManager.


Some questions.


1. Is this the right API for my purpose, or would you recommend something else?

2. If I send a deferred event when no listener is running will the events be queued pending a listener being created?

3. If I send the same event again while it is still queued will two events be delivered or does the NotificationsManager spot the duplicate and eliminate it?


 I'm trying to test this out but I'm getting some odd results, so if someone can speak from knowledge or experience I'd be very grateful.





Posts: 17,025
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: NotificationListener and Deferred Events

if no listener is there the event is discarded. there is no queue that waits for your application to start.
the notification mechanism is intended to alert the user, using vibration and/or sound. the specific alert can be set in the profiles advanced settings, thus giving the user full control without you having to implement complex settings.

you have several options:
- use one-time access to the Ui from the background process (Ui.getUiEngine etc) with global alerts.
- launch your application using ApplicationManager
- have a part of your application (or the full one) running at all time, allow the user to put it into the background only (requestBackground() on onClose() )
- don't offer this functionality if the user decides to close the application
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Posts: 62
Registered: ‎05-29-2009
My Device: Not Specified

Re: NotificationListener and Deferred Events

Hi Simon


Thanks for this.  Just one thought - I'm not using immediate events (used for vibration, sound), I'm using deferred events (intended for UI components that interact with the user).  Does your answer apply there?


In any case all your solutions look good, so I'll probably try one of these.