I'm using Ionic Framework to build an Android/iPhone cookbook app with Angular.
One of the features should be alarms/timers for each ingredient/step.
Ionic is based on a wrapper around Apache Cordova, I guess. So I've tried using a Cordova plugin, from an answer below... but it's older and it's not specifically for Ionic, and I've tried a few times but it just hasn't worked for me. I haven't found any alternatives.
doSomething() {
let successCallback = () => window.confirm('success');
let errorCallback = () => window.confirm('fail');
// set wakeup timer
(<any>window).plugins.wakeuptimer.wakeup(successCallback,
errorCallback,
// a list of alarms to set
{
alarms : [{
type : 'onetime',
time : { seconds : 5 },
extra : { message : 'json containing app-specific information to be posted when alarm triggers' },
message : 'Alarm has expired!'
}]
}
);
}
Local notifications are kind of an option, but it's just a notification. It doesn't work like a native alarm clock. (It's like getting a text, but you miss it so your burgers burn.)
Can anyone give an example of an alarm or timer in a modern Ionic app? Maybe I'm just missing something to get the plugin to work?
Or is there any kind of alternative I'm missing?
I'm getting bummed that the app is almost done but I've been stuck on this. :(