kyle
kyle

Reputation: 197

Cordova alarm clock

I have built a Cordova alarm clock app that has a timer. Everything works good except that I now want to inform the user when the clock is up with a visual and audio alarm.

I have used the following plugin for local notifications: https://github.com/katzer/cordova-plugin-local-notifications

This seems to work good except that it doesn't seem to work when the phone screen is off.

Any ideas of a better way of doing this. I probably want something like AlarmManager in Android but so far I haven't found a Cordova plugin for it.

Upvotes: 4

Views: 11688

Answers (2)

Harry Moreno
Harry Moreno

Reputation: 11643

@AAhad your answer inspired mine. https://github.com/wnyc/cordova-plugin-wakeuptimer is a plugin that works for both iOS and Android devices.

Upvotes: 4

AAhad
AAhad

Reputation: 2845

Have you checked this plugin?

https://github.com/uniclau/AlarmPlugin

To invoke the plugin:

navigator.plugins.alarm.set(alarmDate, 
   function(){
       // SUCCESS
   }, 
   function(){
       // ERROR
   }
);

alarmDate is the date that the application will wake up. This will happen even if the device has been rebooted.

Upvotes: 4

Related Questions