There is an emergency app named Medical Id. It has a marvelous feature in which it shows notification on locked screen. The user can just double tap on the notification to open the activity. For other app notifications, if the user tap, it prompts for unlocking first. I am looking for the same feature but unable to achieve the same. I have tried adding flags to the attached windows.
@Override
public void onAttachedToWindow()
{
super.onAttachedToWindow();
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON &
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD &
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED &
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON &
WindowManager.LayoutParams.FLAG_FULLSCREEN
);
}
Added shownonlockscreen to the activity in the manifest as well, But it prompts for unlocking the screen before opening the activity. Have a look on the medical id for clarity. I don't know what they are using to bypass unlock. The phone settings for notifications are public in my phone. The amazing part is even if your phone notification setting is private, medical id notification will be present there even when no else notification is present. Any leads is helpful.