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

BlackBerry Push Development

Reply
Contributor
Posts: 21
Registered: ‎04-25-2012
My Device: 9800
Accepted Solution

Providing Notifications across App Lifecycle?

Hi, I am implementing push notifications in a Cordova/WebWorks application, and I would like to know what options for notifications I can give my app users during different stages in the app lifecycle.

 

When the app is in the foreground I can post an alert - this is fine. When the app is in the background, I could bring the app to the foreground and alert the user, although I would rather let them know there is a message to be consumed and let the user decide when to access it? The same case applies for push notifications that are received after the app has been closed/killed.

 


As I understand it, using webworks I don't have access to the notifications bar (reference) to make my notifications interactive. Although I can use the application API to show/remove an icon + number on the banner/title bar, e.g.

 

bb_banner.png

 

I can also use a wakeup page to display notifcations that were received while the app was in the background or killed state. Is there anything I have missed, and is the above correct? Any suggestions on how to best handle push messages during the background and killed states are very welcome. Thanks

Retired
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10

Re: Providing Notifications across App Lifecycle?

When a push comes in and your application is closed your application should get launched. There is no restriction to what can be done when your application is launched or how you handle the push. Push and notifications are completely separate.

Garett
@garettBeuk
--
Goodbye everybody!
Contributor
Posts: 21
Registered: ‎04-25-2012
My Device: 9800

Re: Providing Notifications across App Lifecycle?

Thanks for the quick reply.

 

Yes, when the app is closed, a push message is launching the application, but in the background (it's visible in the task switcher). Without some notification, the user would not neccessarily be aware that a new message has arrived, without going into the app - I don't want push messages to open the app in the foreground without the user's consent/intention. I understand that push messages and notification are separate entities, but I am interested in how these can work together (using notifications to give the user control as to if/when to consume incoming messages when the app is not already in the foreground - I should have maybe worded my post differently).

 

I think my strategy will be to check if the app is in the background when a push message comes in, if so, save the push message blob/string to local storage, increment the banner number and then give the user the option to consume/read the message when they re-enter the app. 

Retired
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10

Re: Providing Notifications across App Lifecycle?

Sounds like a solid plan :smileyhappy:

Garett
@garettBeuk
--
Goodbye everybody!