benCoding.AlarmManager
benCoding.AlarmManager copied to clipboard
If application is in background or not running AlarmService doesn't trigger
Hello! I am trying to use this module to provide an agenda events-scheduler to my application.
I have added a service.js file which is executed when the AlarmService triggers:
var json = JSON.parse(Ti.Android.currentService.getIntent().getStringExtra("customData"));
var requestCode = "" + json["requestCode"];
playAlarmSound();
Alloy.createController("_agenda_alarm", {requestCode: requestCode}).getView().open();
function playAlarmSound() {
var player = Ti.Media.createSound({
url : "audio/alarm.wav",
allowBackground: true
});
}
Basically I want to open a custom modal window where i can get input from the user. My problem is that when the application is in background or not running the AlarmService is not triggered. When the app is in background i would like that the AlarmService restores it in foreground and runs the custom code defined in my service, on the other hand if the app is not running i would like that at trigger time the AlarmService starts the application and runs the custom code of the service. Is this possible? How can i do that?
I am using Titanium SDK 5.3.0
Thanks in advance for any help!