I'm taking lots of inspiration from app Go Locker and project LockScreenApp, to create a basic lockscreen app that displays various pictures, randomly picked from a folder on device storage. App is working fine. My event receiver receives ACTION_SCREEN_OFF
event properly, kicking off my Activity
, which is visible on front when screen is switched back on. I can swipe on my view to "unlock", works fine. So far so good.
Next step is to handle home Button
. Now I know that onAttachedToWindow()
of handling home Button
press doesn't work with 4.X. I'm working with S2 (4.1.2).
Although, it definitely seem possible, as Go Locker does this (on the same device) flawlessly, without a single blink on the screen.
Initially I thought setting my app as default launcher might resolve this, but Go Locker doesn't do that. I can successfully continue using my Nova Launcher as my default launcher, yet Go Locker lockscreen successfully intercepts HOME key press and keep me on the lockscreen.
I tried intercepting onPause()
& onStop events on my
Activity, and kicking off another instance of my
Activity` from there, but it doesn't work that way.
Go Locker seems to be doing something cleverer than that. Any idea how this can be achieved please?