开发者

How to set alarms using alarm manager running every weekdays

Hey guy开发者_运维技巧s I'm using alarm manager to run my application at specific point of time. I want to run my application on every weekdays ( Mon-fri ) so could you please tell me how to do this.


I don't know of a way to use the AlarmManager to trigger weekday based alarms. As a workaround, can you trigger the alarm every day, then in your code check what day of the week it is, and only perform your actions on the days you require?

I'd be interested to hear any other approaches.

EDIT
Actually, could you set a daily alarm first. Then when the alarm is triggered, check if the day is Friday. If so, write a new alarm that will trigger on Monday. When that goes off, create the daily alarm again. Feels a bit clunky, but would cause the phone to wake up less.

You will need to handle the case when the user restarts their phone and ensure that any alarm that was set is recreated.


here is what needs to be done

  • setup a Broadcast receiver to receive the event
  • now schedule the event using Alarm Manager
  • modify the previous receiver to start the app or activity

http://justcallmebrian.com/?p=129

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜