So, I created an application that functions as a lock screen replacement. I use the broadcast receiver and service to start my activity after Intent.ACTION_SCREEN_OFF . So that every time the user locks the screen, my activity starts, and then when they press the unlock button, my activity is already running on the lock screen. But this only works if the user tries to wake / unlock the phone after a short period of time. If they wait too long, activity will disappear. Iām not sure why this is happening and what I can do to stay active there, no matter how long the user waits to unlock their phone.
I thought and tried to listen to Intent.ACTION_SCREEN_ON , but then between the time when the user presses the power button on his phone, he wakes him up and when the application loads and appears on the screen. During this gap, the user can see the Android OS.
Peter
source share