Use the BOOT_COMPLETED broadcast to register your alarms at boot. On Sat, Aug 8, 2009 at 9:48 PM, [email protected] <[email protected] > wrote:
> > I think AlarmManager can not keep running in case the device has once > turned off. This is an explanation extracted from > > http://developer.android.com/intl/zh-CN/reference/android/app/AlarmManager.html > and it told me AlarmManager isn't what I want: > Registered alarms are retained while the device is asleep (and can > optionally wake the device up if they go off during that time), but > will be cleared if it is turned off and rebooted. > > > > On 8月7日, 下午6时50分, Pradeep Kaushik <[email protected]> wrote: > > Hi, > > You can use the AlarmManager for such tasks. > > > > Sample Code: > > ========== > > > > AlarmManager am = (AlarmManager)getSystemService(Context.ALARM_SERVICE); > > PendingIntent pi = PendingIntent.*getBroadcast*(getApplicationContext(), > > REQUEST_CODE, intent, PendingIntent.FLAG_CANCEL_CURRENT); > > am.set(AlarmManager.RTC_WAKEUP, SOME_TIME_IN_FUTURE, operation); > > > > The flag AlarmManager.RTC_WAKEUP will cause the device to wake up. You > can > > also try the AlarmManager.ELAPSED_REALTIME_WAKEUP flag. > > > > Best Regards, > > Pradeep Kaushik > > > > On Fri, Aug 7, 2009 at 10:50 AM, [email protected] < > > > > > > > > [email protected]> wrote: > > > > > Maybe I was misunderstood. What I want is to continue my notification > > > effect even the device has once shut down, just like an alarm clock. > > > If you really get it, please explain it for in detail? Thanks a lot! > > > > > On 8月6日, 下午4时52分, peter <[email protected]> wrote: > > > > Set flag of Notification, there have sort of flag to let your > > > > notification show > > > > > > like this:"Notification.flag = Notification.FLAG_AUTO_CANCEL" > > > > > > On Aug 6, 4:42 pm, "[email protected]" <[email protected]> > > > > wrote: > > > > > > > Hi all, > > > > > I have an application with notification. I want to keep the > > > > > notification working even if the device once shut down just like an > > > > > alarm. Could anyone give me some sample code to help me? > > > > > Thank you in advance!- 隐藏被引用文字 - > > > > > > - 显示引用的文字 -- 隐藏被引用文字 - > > > > - 显示引用的文字 - > > > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

