GiladH wrote:
> My app seldom needs to put the device (or screen) to sleep.

I suspect the Android model says that the user controls when the device
goes to sleep, either by the power button or via the user-selected
inactivity timer.

> According to docs PowerManager.goToSleep() does just that, but
> requires android.permission.DEVICE_POWER, which is never granted to
> apps!

That appears to only available to firmware-based apps. To quote Ms.
Hackborn:

"Whoops, I just looked and this permission is not available to
applications.  Sorry, it isn't possible for apps to do this."

> (A) What on earth should i do to get this working?

Modify the firmware.

> (B) How can i programmatically wake up the device.

Use AlarmManager to broadcast an Intent at the time you want to do some
work and have the device wake up. In the BroadcastReceiver, either do
the work you need to do (if it is short), or obtain a WakeLock (probably
via a singleton), start a service, have the service do the work, then
have the service release the WakeLock.

> just to clarify - i'm not interested in a wake lock solution

You don't need to hold a WakeLock, so long as you're willing to allow
the device to go right back to sleep once your BroadcastReceiver's
onReceive() returns.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android Development Wiki: http://wiki.andmob.org

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