The screen being off does not mean the device is asleep. Often the screen will be off but the CPU will still be running to background work, in which case this alarm will go off.
On Mon, Jan 5, 2009 at 1:32 PM, ArtJin <ajin...@gmail.com> wrote: > > Hello everybody. > For some reason the AlarmManager keeps running even when the phone is > asleep. > Here is the code that I use: > PendingIntent mAlarmSender = PendingIntent.getService(Main.this, 0, > new Intent(Main.this, mService.class), 0); > AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE); > am.setRepeating(AlarmManager.ELAPSED_REALTIME, > SystemClock.elapsedRealtime(), ALARM_SCHEDULE, mAlarmSender); > According to docs ELAPSED_REALTIME "...does not wake the device up; if > it goes off while the device is asleep, it will not be delivered until > the next time the device wakes up" > > Described here: > http://code.google.com/android/reference/android/app/AlarmManager.html > > For some reason AlarmManager keeps running mService even when screen > of the phone is off. > The mService is a regular Service that supposed to connect to my web > server and periodically get some data, but I do not want the app to > connect to my server unless the phone is fully awake. > > Am I missing something in the code or in the docs? > > > > > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. 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 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 -~----------~----~----~----~------~----~------~--~---