I have an app开发者_如何学运维lication for android using PhoneGap. I want to create a system of four alarms. Each alarm set will be repeated in 24 of 24. How do I create it? and how can I remove the alarm, whenever the user to set a new time for a touch of alarm? I like to use PhoneGap, keep the clock with localStorage!
PhoneGap has no support for AlarmManager
AFAIK.
What you are looking for can be achieved using the LocalNotication plugin. In my own app i use it to set up a daily reminder, theoretically it can set up several of those at specific times.
Setting up daily alarm from your html5 app then is as simple as follows:
plugins.localNotification.add({
date : new Date(),
message : "Phonegap - Local Notification\r\nSubtitle comes after linebreak",
ticker : "This is a sample ticker text",
repeatDaily : true,
id : 1
});
You can create different alarms by using a unique id, which may also be cancelled and/or recreated (thus modified) individually before their alarm time, if needed.
精彩评论