My Question is similar to this one How can I wake an android device up and skip the screenlock
I want to display a dialogue box from broadcast receiver, but Android API is not allowing me to do that therefore I am using starting an activity from there and changing the theme of this activity to Theme.
Now I want this activity to be displayed even when phone is in locked mode/ sleep mode.
Screen I am able to turn on bu using below flags but Key Guard (Non Secured) I have to unlock manually. I am not able to see my window over locked screen.
The difference is that I am not using a full screen Activity i.e.
android:theme="@android:style/Theme.Dialog
in my code I am using
Window w = getWindow();
w.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON |
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD |
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
I don't succeed in achieving this feature by using these Flags, but I did succeed by using the WakeLock and KeyguardLock. Below is what I do:
Of course, you still need to declare the permission in the manifest file.