I'm developing an application which working on backround and in some particular event I have to show the activity even if the screen is locked.
So I tried to use flags instead of keyguard and wakelock, but I noticed that is only works when the screen is off without any password, pattern and etc... and when there is a password or something else, I see that the screen is turn on but the activity is dismissed...
Note: The activity theme is transparent because I only need to show the speech recognizer dialog...
This is the code I have to show the activity over the keyguard or when the screen is turned off
@Override
public void onAttachedToWindow()
{
Log.d(TAG, "onAttachedToWindow");
super.onAttachedToWindow();
Window window = getWindow();
window.addFlags
(
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD |
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
);
}
So how can I dismiss the lock screen and show the activity?