Isn't View.setKeepScreenOn(true) doing the same thing (or similar)? On Mon, Jan 12, 2009 at 5:13 PM, madcoder <[email protected]> wrote: > > Try this: > > PowerManager pm = (PowerManager) this.getSystemService > (Context.POWER_SERVICE); > WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "My > Tag"); > wl.acquire(); > > when you are done with wake lock, > wl.release(); > > Alternatively, you can use this if you have only one activity: > PowerManager pm = (PowerManager) this.getApplication().getSystemService > (Context.POWER_SERVICE); > > It's important to remember to release your wake lock. I don't know > the 'perfect' or 'standard' way of using it, but anytime my activity > receives onPause(), I release it. > > I had a nasty bug once where my app didn't release it, and because it > was still running in the background, my phone didn't sleep for quite > some time, almost draining the battery completely! > > BTW, your app works great - my girlfriend became a zombie for a few > moments and didn't remember anything I did to her! > > > > > >
--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

