So although i have not completed the ios post we will continue onto the dreaded Blackberry. Funnily enough this was one of the easiest ones to create.
I make use of the apache ant compile using the config.xml to allow access to features and whatnot. So where do we begin, well for a start read through phonegap tutorial here is the link, this instructs you to setup the correct environment and gives you a sample that you can compile and test.
ps. One quirk is that I was unable to compile using the latest webworks and had to use version 2.3. You may not have this problem but if you do here is the solution.
I will post more on the setup and compiling using apache ant later.
So notifications where do we start, the best place would be to understand a little about the compiling of the phonegap application. The application is compiled through webworks which is very good because it allows us to not only make use of the phonegap methods but allows us to make use of the webworks methods as well. I find that step by step tutorials are the easiest to follow so I will put it out in the way.
More to come...
First lets look at the webworks push notifications listener here is the link . So as instructed we have adapted the .xml file to cater for receiving the notifications, now onto the code. I found out that inserting the code in the ondeviceready function seemed to work the best as the listener must be run each time the application is opened. I made use of the openBISPushListener which is supplied in the sample code in the link above.
Secondly now that you have got your head around the sample code you need to enroll with the Blackberry push service.After a while they will supply you with details that you will put into your BIS port and in the php code to send the push notification. I will provide a link to this later.
There is one thing that you need to take into account when sending a notification to your application. In order to receive when the application is exited you need to capture the onexit event that gets fired and set your application to run in the background. I will supply the code to do this at a later stage.
More to come on sending the push and setting a icon in the banner.....
At last here is the code for the banner plus the beep to alert the user he has received a notification
blackberry.app.showBannerIndicator("icon.png",1); //I have set the count to one however you might want to calculate how many notifications are outstanding.
navigator.notification.beep(1);//This is the beep that will be played on receiving the message
These two methods must be placed in the ondata method.