Hi,
wanna ask again about Mark's first warning:
" Your service will not be running for very long once the screen turns
off. The phone will go to sleep, and your service will stop running
when
the phone turns off the CPU. "

when the phone turns on the CPU again, will the service restarted
automatically?
if it won't, how to know if the CPU has been turned on/off?

thanks

On Sep 27, 5:35 pm, sleith <raysle...@gmail.com> wrote:
> Hi,
> thanks Mark for your advice, that's a nice input from you :)
>
> On Sep 27, 5:26 pm, Mark Murphy <mmur...@commonsware.com> wrote:
>
> > sleith wrote:
> > > i've tested when the phone screen is off, the service is still
> > > running, but when the service try to start intent, the screen is still
> > > not shown because it's off. when the screen is on again, i can see the
> > > intent that was launched by service.
> > > is there any way to make the screen on by programming? because when we
> > > receive call, the screen will on. so i think it is possible :D
>
> > First, the warnings:
>
> > 1. Your service will not be running for very long once the screen turns
> > off. The phone will go to sleep, and your service will stop running when
> > the phone turns off the CPU.
>
> > 2. Doing things that wake up the phone are bad for battery life. See
> > Jeff Sharkey's "Coding for Life...Battery Life, That Is" presentation
> > from Google I/O 2009 for statistics.
>
> > 3. Popping up user interfaces from a service are bad for the user
> > experience. If the user is, say, in the middle of typing a text message,
> > and your service-spawned activity steals the foreground, they may have
> > quite a few profanities to fling in your direction. An incoming phone
> > call is one of the few things users might tend to agree warrants such an
> > intrusion...and I suspect there are still many a curse word used when
> > users get interrupted, even for that.
>
> > Hence, before you even bother with any code, you need to really make
> > sure that this is what you want to do, and consider offering user
> > preferences to disable this functionality.
>
> > All that said, you will want to look at PowerManager.WakeLock to arrange
> > to keep the screen and CPU on for a while. Which leads to:
>
> > 4. Misusing WakeLocks are horrible for the battery. Do not leak an
> > acquired WakeLock.
>
> > --
> > Mark Murphy (a Commons 
> > Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> > Android Training in Germany, 18-22 January 2010:http://bignerdranch.com
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to