I found a way to turn the screen off but it requires Admin privilege. I used DevicePolicyManager.lockNow().
More here: http://marakana.com/s/post/1291/android_device_policy_administration_tutorial On Saturday, April 20, 2013 1:15:20 AM UTC+3, sebouh00 wrote: > > I have the following goal in my application. I want to wake the phone up > and turn the screen on for 1 second from within my service and let the > phone go back to sleep. I would like to do this in intervals throughout the > day. The sole purpose of this is that turning the screen on will update the > cell network data for some devices. I use this data in my application to > execute some actions based on the cell id. > > I've used the following approach successfully on earlier releases of > Android: acquire a wakelock with ACQUIRE_CAUSES_WAKEUP > and SCREEN_DIM_WAKE_LOCK flag with a timeout of 1000 ms. > > When this executes, the screen goes on for 1 sec and then switches off. > The problem is on 4.2 the screen stays on until the user-set display > timeout expires, even though I've release the wakelock. I have tested this > several times on several devices running 4.2.2 and 4.2.1. I would > appreciate some advise on how to do this. I understand that the > SCREEN_DIM_WAKE_LOCK is deprecated, but I have not found any other means of > achieving this. > > Thank you, > Sebouh. > > -- -- 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 unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

