11-21-2012 06:33 AM - edited 11-21-2012 06:34 AM
I've developed an application using PhoneGap. The application has an alarm system, in other words, at an user-configured time an alarm dialog is displayed, then in this dialog if the user press the "continue" button the application will show a page.
I've managed to put this working in Android, iOS and Windows but not in Blackberry. Anyone has an idea how this is done using BB WebWorks & PhoneGap?
11-22-2012 11:57 AM
Which BlackBerry platform are you targeting with PhoneGap (BBOS, PlayBook, BB10)? Also, have you confirmed that the Phonegap APIs you are using are supported on the noted BlackBerry platform?
Are you using the latest version of Phonegap/Cordova?
11-22-2012 01:10 PM
Thanks for that. Would you happen to have a sample application you could post on JSBin or JSFiddle for us to reproduce / investigate with?
Also, which part are you finding to not work? Is it that the notification isn't appearing at the pre-determined time, the new page isn't opening, etc. The more information you can give the better :-)
11-22-2012 01:13 PM
Well oros, I don't have any code since I don't know how to make this. I've made it working with other systems like Android, iOS and WinPhone. For those I've used the LocalNotification plugins existing in GItHub. But for these functionality I can't find anything to use with BlackBerry.
11-22-2012 01:41 PM
It seems that Phonegap has a Notification API available inherently that is supported on the BlackBerry platform (i.e. no need for external plugins.)
Apologies if I'm misunderstanding, but using the above in a Phonegap applicaiton, and then simply using the commands to compile for BlackBerry should provide you with the ability to display an alert.
In terms of recognizing when a specific time occurs, are you using any platform-specific functionality for that or just Phonegap / pure HTML5 scripts? If Phonegap / HTML5, the same approach should work on the BlackBerry platform as well.
If we're looking at a WebWorks API, the Dialog API might be of use:
You can also integrate directly with the Calendar and schedule an Appointment for the user:
To me it seems that most of what you described should be available through HTML5 and Phonegap APIs though, common across most platforms out there with minimal need to actually customize with native code.
11-22-2012 01:48 PM
I need to create an alarm. The alarm has to be raised even if the application is in background. When the alarm is raised a Local Notification (not Notification) is shown, then the user activates (clicks) the LocalNotification and the application opens in a specific html5 page.
Android & iOS, used LocalNotification
WinPhone, used Reminder.
Is it possible something like this in Blackberry?
11-22-2012 02:13 PM
Technically, this should all be possible. With respect to the Local Notification, I believe this functionality is equivalent to the MessageList API community extension:
This API allows you to add a notification to the main system list, and clicking that notification will launch your application.
If you need this to be a Dialog, and with Local Noticiation my understanding is that you want the dialog to show even if your applications isn't in the foreground, then you can use this to trigger a global dialog:
However, you will need to create your own custom extension to invoke your application when the dialog is accepted.
Personally, I would recommend the MessageList approach, in conjunction with the Dialog.
On OS7, it certainly is possible to create an application that runs in the background:
11-22-2012 05:22 PM
While you can set an appointment in the user's calendar, you won't get the same sort of notification that you're mentioning. As far as I can tell, you would need to implement your own form of "alarm" tracking.
For instance, local storage could be leveraged to save any pending alarms. On application launch, or when a new item is added to local storage, you could leverage something as simple as a setTimeout which would trigger an action at a certain point in the future. Once triggered the item would be removed from local storage. While not as elegant as scheduling a reminder, the end result would be fairly close.
There may be other options available as well, but the above should be one of the simpler ones, implementation-wise.