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 <pra...@gmail.com> 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, guishenl...@gmail.com < > > > > guishenl...@gmail.com> 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 <heywoodpres...@gmail.com> 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, "guishenl...@gmail.com" <guishenl...@gmail.com> > > > 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!- 隐藏被引用文字 - > > > > - 显示引用的文字 -- 隐藏被引用文字 - > > - 显示引用的文字 - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---