Install scheduler programmatically in android

In my Android application, I would like to set up a scheduler for the user at a specific time with details such as on a 3'watch movie, "even if the application is not open at this time.

Is there a way I can do this in android?

+4
source share
2 answers

You can use AlarmManager to display specific actions at a given time. AlarmManager will ensure that the activity or service, if you like, is launched, even if the application is not open at that time, and AlarmManager also compatible with the battery

First of all, you need to get an instance of AlarmManager:

 myAlarmMgr = (AlarmManager) this.getSystemService(ALARM_SERVICE); 

and then you can schedule an action to be displayed periodically or only once:

 myAlarmMgr.setInexactRepeating(AlarmManager.RTC, _whenToStart, _intervalIfAny, _PendingIntentToStartActivityOrService); 

See AlarmManager documentation for more details.

+3
source

You can take advantage of the BuzzBox SDK, which is built on top of AlarmManager and provides you with some additional features for scheduling repetitive tasks. You can use the cron line, and you get the settings activity so that your users can change the time, frequency, days of the week, etc. See: http://hub.buzzbox.com/android-sdk/

0
source

All Articles