开发者

How to make alarm initiate even after restart device?

How to make my calendar events alarm wake up even after restarting the mobile? (i.e) if the current time is 10am; i'm setting alarm for 10.05am and now(10am) if i restart my device, the alarm should ring o开发者_运维技巧n 10.05am. How to achieve it? I have already created alarm for my calendar events. But if i restart my device, the alarm is ringing once i restarted itself. But all other queued alarms are cancelled. Any Help is appreciated and thanks in advance...


Well you can use BroadCaste Reciever, becuase device gets a broadcaste when device switched

on, so you can register for that broadcaste and in its reciever you can schedule your alarm..

here is an example how you can do it, http://www.androidcompetencycenter.com/2009/06/start-service-at-boot/


Put "android.intent.action.BOOT_COMPLETED" as an intent filter in a BroadcastReceiver, then you can receive the phone being powered on and schedule the alarm.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜