jaiesh
jaiesh

Reputation: 146

Displaying on Locked Android Screen

Would it be possible to keep an android device in a locked state while having something displayed on the screen? Meaning all functionality would work as if the device is locked (since it would be locked) and the only difference would be that there is something displayed on the screen. The main purpose of this question is to display something just as the notification bar does in a locked state and to be able to return to the original lock screen instead of having something be displayed on the device and once the lock screen is pressed it blanks out the device and you must press it again to return to the locked interface.

Upvotes: 4

Views: 1962

Answers (3)

k3b
k3b

Reputation: 14775

You can learn how it can be done if you look into the open source project contact owner that adds a message to the lock screen

"if you find this phone please call +49 ..."

Android 4.2 introduces the ability for users to add widgets to the lock screen.

Upvotes: 0

Rohit
Rohit

Reputation: 603

Add this line to your activity. The window will be shown even when screen is locked, as simple as that.

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

Cheers..........!!!!!!!!!

Upvotes: 3

Mat Nadrofsky
Mat Nadrofsky

Reputation: 8264

You can sort of do this. There are some customization tools and how-to's on this front, but from a development standpoint you want to take a look at the comments from CommonsWare in this question.

There is some open source code available that has some stuff you can review on how other folks have done it, but sounds like the Android team is moving away from enhancing this functionality.

Update: Your question also piqued my interest further on this front, so I've been browsing the Google groups on this topic and some others. This is an interesting but older read that has some background on this as well.

Upvotes: 1

Related Questions