Search code examples
androidlockscreen

Create an app to lauch from lockscreen without unlocking


I can put 2 shortcuts on the lockscreen, and with every application installed on my android device. However, I need to unlock the screen when I slide one of those shortcuts, except for the camera: I don't need to unlock and when I close the camera the device shows the lockscreen again.

Now I want to create an application that the user can put in shortcut and opens without unlocking, like for the camera. How can I create that?

I don't want to root my smartphone or install other applications to change the lockscreen.

Thanks you!


Solution

  • You cannot unlock the device however you can show an activity over lock screen.

    Call this when your activity is launched:

    activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);