java - Lock an Android Phone -
possible duplicate:
lock android device programatically
i want able lock android phone password when run method. have reference or sample code me refer. thanks
edit have tried using
keyguardmanager mgr = (keyguardmanager)getsystemservice(activity.keyguard_service); keyguardlock lock = mgr.newkeyguardlock(keyguard_service); lock.reenablekeyguard();
as said answer below, i'm still trying add password have entered database @ server side, way unlock phone enter password set
edit
http://developer.android.com/reference/android/app/admin/devicepolicymanager.html
been trying work on ^
edit
i have seen that
device_admin_sample.xml
with contents
<device-admin xmlns:android="http://schemas.android.com/apk/res/android"> <uses-policies> <limit-password /> <watch-login /> <reset-password /> <force-lock /> <wipe-data /> </uses-policies> </device-admin>
but put xml file at.. seems have error wherever put
edit
now, have implemented halfway , put on hold upon seeing comment below cannot lock phone password. seeing api documentation, there's function reset password new password.
resetpassword(string password, int flags)
so it? can implement password lock on phone? or idea of locking phone until new password given server entered, unable done?
your app cannot stop pressing home button , getting out of app. prevents malware or bad coded app lock phone point need remove battery out of crapware.
you can programmatically lock screen usual screen locker though :
keyguardmanager mgr = (keyguardmanager)getsystemservice(activity.keyguard_service); keyguardlock lock = mgr.newkeyguardlock(keyguard_service); lock.reenablekeyguard();
this require "disable keyguard" permission in manifest file.
edit after op refinement :
take @ sample shows how use device admin manager : http://developer.android.com/resources/samples/apidemos/src/com/example/android/apis/app/deviceadminsample.html
Comments
Post a Comment