My application does have a custom notification which appears when the application is launched. The notification needs to have a button that opens a specific activity.
My problem occurs when the button is clicked by the user on the lockscreen. If the application was in background when the phone was locked, then the phone will unlock (by asking the password) and the activity will be launched. But if the application was in foreground when the phone was locked, then the phone will not unlock and I don't know why.
In my onCreate()
, I put these parameters :
Window window = this.getWindow();
window.addFlags(LayoutParams.FLAG_DISMISS_KEYGUARD
| LayoutParams.FLAG_TURN_SCREEN_ON);
}
and I launch the activity with :
Intent in = new Intent(context, MyActivity.class);
in.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK);
activity.startActivity(in);
Thank you for your help !