Webworks lesson learnt today: banner notifications
One of the reasons I wanted to start this blog was to have the possibility of teaching others a few things which I learn the hard way. Sometimes I have to bang my head on the wall for a few hours, until I finally find out a solution (usually, a simple one). In order to help others avoiding that, I want to share the pitfalls I encounter along the way, and the quick and easy way to solve them.
Today, this was the one:
How to the display a banner notification in BB smartphones?
Using WebWorks, you can call the blackberry.app.showBannerIndicator() function to easily display a notification on the home screen banner bar.
This function can take 1 or 2 arguments: 1, the notification icon and 2, a number to go with the icon (optional).
It’s really simple, but for some reason I was getting exceptions thrown all the time. After a lot of digging in forums, here are the 2 problems you might face, which as of this version of WebWorks (2.1.3) will not allow it to work:
- The icon must exist, and its dimensions must be between 10×10 and 32×32
- The icon path must be something like “images/icon.png”, unlike the set homescreen icon function that takes a “local:///images/icon.png” argument.