4

Let me begin by saying that, yes, I know that the stock Android lock screen can not be programatically replaced without rooting.

Now that that's over with, I want to make an app that contains a custom 'lock' mechanism. There are apps out there that emulate this functionality, namely LockGo. This allows a user to view information from widgets on a 'lock screen' and emulates the slide-to-unlock functionality (or whack-a-mole if the user wants to install that plugin).

Does anyone know what mechanism or Android API functionality they may have used to do this? Is it as simple as hooking into the power button to launch an activity, such as in the link below?

How to hook into the Power button in Android?

Any insight to this would be appreciated.

Community
  • 1
  • 1
unaligned
  • 160
  • 1
  • 9

1 Answers1

1

I've found out while researching this that, while there is currently no way to replace the stock security or keyguard lock (which I knew), it is possible to show an Activity on top of the lock using the following code in the setup for that Activity:

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

This can be used with any logic needed to create a faux lock to show screens on top of the system lock(s), though the lock will still be in tact and the user will need to enter the lock to get into the device.

unaligned
  • 160
  • 1
  • 9
  • There is also a DISMISS_KEYGUARD flag too, but that forces your app to be fullscreen. – Tom Jul 03 '12 at 12:42