Home > Uncategorized > Webworks lesson learnt today: banner notifications

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.
About these ads
Tags:
  1. Liam McCann
    June 25, 2012 at 10:41 am | #1

    Is there away to cancel the notification once displayed…

    For exampe user has edited a form and application went background.
    Make a notifcation savign “Please save your data before turning off the device”
    But then the user doesnt read the nofication and goes back in to the application and saves it..

    Can this be done + Nice blog :)

  2. June 25, 2012 at 10:49 am | #2

    Hi Liam.
    Yes you can clear all the notifications manually. There’s a function to remove the banner indicator, and the notification extension also has a function to cancel the notifications (LED, sound, etc).
    Thanks :)

  3. October 5, 2012 at 6:37 am | #3

    I like what you’re doing, really noble.
    For the benefit of others who might be reading this blog to solve a similar problem you should also remember to include in your config.xml

    I have added the openBISPushListener() to my app and when i execute a push from the push server, the application wakes up the designated page but i have no banner indicator to show that the push has been received.

    At this time, what I want to know is, where to trigger blackberry.app.showBannerIndicator() function.

  4. October 5, 2012 at 8:42 am | #4

    Hi Oladele,
    From what I understood, I think the showBannerIndicator button would go into the page called on wakeup by the openBISPushListener.
    All the best,
    Nuno

  5. October 5, 2012 at 6:03 pm | #5

    Liam, sir, I would shake your hand but geography is still our reality, so kindly accept a thank you instead.

    All the pieces of my app are in place… Now to go make some real money..

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 406 other followers