1

Requirement here is to trigger some task (like enabling\disabling wifi ) on particular time(suppose 8am) of a particular day(suppose Wednesday an Tuesday) in a week Application may or may not be in foreground.There will be multiple schedules.

1.After searching on Google I came across approach of using alarm manger and register a event using BroadcastReceiver for particular time and day I want and call service to execute the task and terminate service when task is done. (I doubt how next day timing events can be register and keep repeating those events on weekly basis)

2.Create all time running service and then use alarm manager to create broadcast receiver for just today's event and call thread to execute the task and terminate thread when task is done. (service will read database for everyday's schedule and define appropriate broadcast listener for a day)

Which approach correct ? better alternatives ?

sandeep_jagtap
  • 1,484
  • 2
  • 17
  • 24

0 Answers0