12-04-2012 05:25 AM
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.
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
Solved! Go to Solution.
12-04-2012 08:02 AM
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.
12-04-2012 08:42 AM
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.