I've done an app that must work in the background fetching messages from a web site that must never sleep. For that I'm using PARTIAL_WAKE_LOCK, let the screen turn off and wake it when there is a new message. Here's some code:
---------- public void onCreate(Bundle savedInstanceState) { pm = (PowerManager) getSystemService(Context.POWER_SERVICE); wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP "screenOff"); wl.acquire(); .... // on the URL reading method: while ((line = reader.readLine()) != null) { if (!pm.isScreenOn()) { // There is a message, turn the screen on pm.userActivity(SystemClock.uptimeMillis(), false); Log.i(TAG,""Screen on"); ... do stuff ---------- This has two problems: 1) The screen doesn't turn on, as expected (although the code is run, including the Log.i) 2) How to prevent the appearance of the default lock screen? That is, how can it jump directly to my app after the screens turns off and the users touches a button or the screen? I've tried to (re)acquire the wakelock to turn the screen on but that doesn't work. Thanks in advance! -- 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