Muhammad Zahid
Muhammad Zahid

Reputation: 597

How to lock Screen Android

I am working on android fingerprint Screen locker. how i locked and unlocked android device Programetically. i used onTouchListner on an image and Count the time of Action_down (means thumb pressed). on Action_Down I want to code unlock.

anyone help Please

Upvotes: 1

Views: 1256

Answers (1)

kodartcha
kodartcha

Reputation: 1073

To lock your device programmatically use:

DevicePolicyManager deviceManger = (DevicePolicyManager)getSystemService( Context.DEVICE_POLICY_SERVICE);

Then call:

deviceManger.lockNow(); 

Wherever you need to lock it.

Hope it helps!

Upvotes: 2

Related Questions