Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 603
kyle Avatar asked Feb 13 '23 09:02

kyle


2 Answers

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.

like image 141
AAhad Avatar answered Feb 15 '23 11:02

AAhad


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

like image 22
Harry Moreno Avatar answered Feb 15 '23 10:02

Harry Moreno