I have an activity that needs to turn screen on(if offed) when it is started. So in onCreate, I have:
this.getWindow().setFlags(
WindowManager.La
The workaround by Manish Mulimani worked for me, except I first check for the window focus and then call through to the super.onPause():
public void onPause() {
mFocusDuringOnPause = hasWindowFocus();
super.onPause();
}
public void onStop() {
super.onStop();
if (mFocusDuringOnPause) {
// normal scenario
} else {
// activity was started when screen was off or screen was on with keyguard displayed
}
}