> 1. If my device goes to sleep just when some AsyncTask was executing, what
> will happen ? Will the task execution stop and wait till the device turns
> back on ?

Yes, if you do not hold a WakeLock.

> As per my understanding, when there is no Wake Lock, then the
> CPU
> will stop..and so will all scheduling services that use it.

Yes, with the exception of things scheduled via AlarmManager with WAKEUP
flags.

> 2. The same question, if i have spawned a custom worker thread which was
> active..and the device slept. What will be the status of my worker thread
> ?

It will not run while the CPU is off. It will run while the CPU is on.

> 3. If the application had bound itself to a network interface (suppose an
> IP
> address obtained due to a WiFi connection)..and the device goes to sleep.
> Will this connection be lost if I do not take a WiFiLock ?

Yes. You can see this effect on a device -- the status bar icons will show
you on the mobile data connection, with the WiFi icon showing up again in
a few seconds.

> 5. Is it possible to test the deep sleep behavior using the Emulator to do
> some sanity testing for my application ? I could not find a way to do so.

Not that I am aware of.

> 6. In some of the use cases that i have, the screen can be turned
> off...however i want the CPU running for sometime after the screen is
> dark.
> For such scenarios, is the
> PARTIAL_WAKE_LOCK<http://developer.android.com/reference/android/os/PowerManager.html#PARTIAL_WAKE_LOCK>
>  the best approach  for me?

Yes, though please be respectful of your user's battery life.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html


-- 
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

Reply via email to