Re: [android-developers] Handler.postDelayed not working when screen goes off
Ok thanks I will look into using that, I don't want to drain the battery now :) thanks for your help. On 20 November 2010 21:11, Mark Murphy wrote: > On Sat, Nov 20, 2010 at 4:09 PM, Paul Townsend wrote: > > I started by using timer() but that done the same thing, basically when > the > > times up it makes a noise then starts the next timer in a que > (Intervals), > > but I would like this to happen when the screen goes blank. > > In that case, I'd echo part of Kostya's answer: use AlarmManager with > a wakeup-style alarm. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://github.com/commonsguy > http://commonsware.com/blog | http://twitter.com/commonsguy > > _The Busy Coder's Guide to Android Development_ Version 3.2 Available! > > -- > 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 > -- 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
Re: [android-developers] Handler.postDelayed not working when screen goes off
On Sat, Nov 20, 2010 at 4:09 PM, Paul Townsend wrote: > I started by using timer() but that done the same thing, basically when the > times up it makes a noise then starts the next timer in a que (Intervals), > but I would like this to happen when the screen goes blank. In that case, I'd echo part of Kostya's answer: use AlarmManager with a wakeup-style alarm. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.2 Available! -- 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
Re: [android-developers] Handler.postDelayed not working when screen goes off
I started by using timer() but that done the same thing, basically when the times up it makes a noise then starts the next timer in a que (Intervals), but I would like this to happen when the screen goes blank. On 20 November 2010 21:03, Mark Murphy wrote: > On Sat, Nov 20, 2010 at 3:58 PM, Paul Townsend wrote: > > I made a simple countdown timer and it works as expected when plugged > > in via usb for debugging but when I take it off debugging and the > > screen goes off either time out or power button the handler fails to > > fire at the end time. I have created a custom timer class that gets > > created from the main activity when needed, because its able to have > > multiple countdowns running at the same time. Am I right in thinking > > that the handler just gets paused when the screen goes off and if so > > what are my alternatives. The activity is still in the foreground and > > I assumed the handler would still fire if the screen goes off. > > Your problem is not that the screen is turning off. Your problem is > that the CPU is stopping as part of sleep mode. This is generally A > Really Good Thing from a power management standpoint. > > What are you trying to accomplish via postDelayed() that is supposed > to keep going after the device falls asleep? > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://github.com/commonsguy > http://commonsware.com/blog | http://twitter.com/commonsguy > > _The Busy Coder's Guide to Android Development_ Version 3.2 Available! > > -- > 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 > -- 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
Re: [android-developers] Handler.postDelayed not working when screen goes off
On Sat, Nov 20, 2010 at 3:58 PM, Paul Townsend wrote: > I made a simple countdown timer and it works as expected when plugged > in via usb for debugging but when I take it off debugging and the > screen goes off either time out or power button the handler fails to > fire at the end time. I have created a custom timer class that gets > created from the main activity when needed, because its able to have > multiple countdowns running at the same time. Am I right in thinking > that the handler just gets paused when the screen goes off and if so > what are my alternatives. The activity is still in the foreground and > I assumed the handler would still fire if the screen goes off. Your problem is not that the screen is turning off. Your problem is that the CPU is stopping as part of sleep mode. This is generally A Really Good Thing from a power management standpoint. What are you trying to accomplish via postDelayed() that is supposed to keep going after the device falls asleep? -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.2 Available! -- 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
Re: [android-developers] Handler.postDelayed not working when screen goes off
Either acquire a wake lock, or use alarm manager with a pending intent and a broadcast receiver. You might still need a wake lock in the second case so that the phone doesn't sleep immediately after the alarm is processed by your receiver. -- Kostya Vasilyev -- http://kmansoft.wordpress.com 20.11.2010 23:58 пользователь "Paul Townsend" написал: I made a simple countdown timer and it works as expected when plugged in via usb for debugging but when I take it off debugging and the screen goes off either time out or power button the handler fails to fire at the end time. I have created a custom timer class that gets created from the main activity when needed, because its able to have multiple countdowns running at the same time. Am I right in thinking that the handler just gets paused when the screen goes off and if so what are my alternatives. The activity is still in the foreground and I assumed the handler would still fire if the screen goes off. -- 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 -- 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