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.
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.
@AAhad your answer inspired mine. https://github.com/wnyc/cordova-plugin-wakeuptimer is a plugin that works for both iOS and Android devices.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With