Sorry to ask the obvious, but are you sure you have the "android.permission.WAKE_LOCK" permission declared in your AndroidManifest.xml?
On Tue, Feb 9, 2010 at 3:11 PM, guich <[email protected]> wrote: > Hi, > > I'm trying to programatically turn the screen off and on, while keep > the app running. > > If i try this code: > > final PowerManager pm = (PowerManager) > loader.getSystemService(Context.POWER_SERVICE); > AndroidUtils.debug("creating lock"); > screenLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, > "TotalCross"); > AndroidUtils.debug("lock: "+screenLock); > screenLock.acquire(); > AndroidUtils.debug("acquired: "+screenLock); > > ... then the application stops at the "acquire" method call > ("acquired" is never printed). > > If i change to: > > PowerManager pm = (PowerManager) > loader.getApplication().getSystemService(Context.POWER_SERVICE); > > (note the getApplication()), then i get: > java.lang.SecurityException: Neither user 10030 nor current process > has android.permission.WAKE_LOCK. > > Am I missing something here? > > thanks > > guich > > -- > 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 -- 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

