gbox
gbox

Reputation: 829

Disable Lock Screen

I am looking for a way to replace the stock lock screen (with an app, not a rom). What is the best way to do it, for a start to disable the lock screen on as much devices as possible? Thanks!

Upvotes: 23

Views: 38459

Answers (4)

Swapnil Kale
Swapnil Kale

Reputation: 3040

Try this, it will keep awake the screen/ display , as long as the activity is on top.

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

Also this does not require any permission in manifest.

Upvotes: 7

hsgubert
hsgubert

Reputation: 2264

You can just use this line in the activity:

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

Upvotes: 33

Mitul Nakum
Mitul Nakum

Reputation: 5574

KeyguardManager keyguardManager = (KeyguardManager)getSystemService(Activity.KEYGUARD_SERVICE);
KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE);
lock.disableKeyguard();

in androidmanifest:

<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>

Upvotes: 40

Faisal Abid
Faisal Abid

Reputation: 9140

Check out this link http://thinkandroid.wordpress.com/2010/01/24/handling-screen-off-and-screen-on-intents/

listen to the screen on intent and I guess just launch your lock screen.

Upvotes: 2

Related Questions