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

Web and WebWorks Development

Reply
New Contributor
dmosinee
Posts: 4
Registered: ‎06-05-2012
My Carrier: iWireless - Developer

How can I make push notifications work correctly when the app is closed?

Hello all,

      I know that this is not true for everyone in every situation, but I feel that the most common implementation of push notifications for app developers is to alert the user to some action that happened, and most of the time the user will NOT be in the app at the time.  The user should see a notification on their phone bar/screen/pulldown/etc. telling them that something happened in app X.  The user then clicks/taps/selects that notification and launches the app from it to see what happened.

 

I've spent many, many hours trying to get the above workflow fully implemented in a blackberry webworks application -- but I still can't get it all.  The official documentation is a mess and only provides trivial examples and little explanation of how the different parts actually work.  Heavy searching of Google yields people with the same issues, but everything is either out of date, incomplete, or simply unanswered.  So I decided to post here in the hopes of getting some help collecting all of the relevant info (that should really be in the documentation) needed to make an app with push notifications.

 

Some specific questions:

- How exactly is the wakeUpPage parameter to openBISPushListener supposed to work?  The documentation indicates that it is supposed to specify a page that is actually displayed if a push is recieved while the app is closed, but that is not accurate.  My tests show that the page (and the app in general) is actually launched in the background with no visibility.

 

- When the wakeUpPage page is launched in the background, it seems (at least in my experiments) that no javascript on the page is actually executed.  Whether I put script right inline or in a body onLoad, it seems like the script is not run.

 

- How exactly should one go about showing a notification on the users homescren/toolbar when a notification comes in while the app is closed?  I have seen some people saying  blackberry.app.showBannerIndicator("icon.png")  but as mentioned above, this code is never executed if I put it in the specified wakeUpPage.

 

- Is any additional work needed to get the app to launch when a user taps the notification on their notification bar / homescreen / etc.  ?  As with most applications, I want a user to be able to tap the notification to go into the app to see what happened.

 

Thanks for looking.  I feel like I am close to getting this thing to actually work, but it's frustrating as there aren't any good examples -- and Ripple is useless for this kind of dev so it all must happen on device or simulator (with all the headaches involved there).

 

Please use plain text.