Reputation: 797
I m developing a simple Alarm Application html
using cordova and phonegap. It works like this.
User Selects the alarm time
App Stores the time on database.
Now all the 1 and 2 steps are done. But for step 3 how app can know when to play the sound? Is there something like cron job
in html or cordova? I need something which can schedule time to execute a function everyday on selected time. I know the javascript setInterval
function but there are limitation on this. It schedules time again when page is refreshed, and there will be also multiple alarms on my app.
Please suggest me how to do this.
Thanks in advance.
Upvotes: 3
Views: 2052
Reputation: 425
setInterval only works if your app is running (and foreground). A better solution is to use the local notifications plugin and set a sound to be played.
Upvotes: 3