Reputation: 17711
I am writing an Android alarm-like app. I want to let the user to choose if to always keep the screen on for the whole application duration, or if she want it to go to sleep according to her device power manager settings.
The first scenario is correctly handled with this code:
getWindow().addFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
But - in the second scenario - when the screen has been swichted off by power manager, I can play a sound via AudioManager, but I can't force the screen to switch on...
I'm using Build.VERSION.SDK = 10 and testing on a Samsung device with Android 2.3.4.
Upvotes: 0
Views: 783