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

Java Development

Reply
Developer
PhilipPearl
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.

 

Regards

 

Phil

Please use plain text.
Developer
simon_hain
Posts: 15,806
Registered: ‎07-29-2008
My Device: Z10 LE
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
Please use plain text.
Developer
PhilipPearl
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.

 

Regards

 

Phil

 

 

Please use plain text.