Implementing screen lock in Android 2.0 -


i implementing screen lock in android 2.0 programmatically , here code.

this.devicemanager = (devicepolicymanager)getsystemservice(context.device_policy_service);         devicemanager.locknow();  

but problem getting security exception.

03-07 12:38:33.665: error/androidruntime(806): fatal exception: main 03-07 12:38:33.665: error/androidruntime(806): java.lang.securityexception: no active    admin owned uid 10075 policy #3 03-07 12:38:33.665: error/androidruntime(806):     @     android.os.parcel.readexception(parcel.java:1247) 03-07 12:38:33.665: error/androidruntime(806):     @   android.os.parcel.readexception(parcel.java:1235) 03-07 12:38:33.665: error/androidruntime(806):     @  android.app.admin.idevicepolicymanager$stub$proxy.locknow(idevicepolicymanager.java:830) 03-07 12:38:33.665: error/androidruntime(806):     @ android.app.admin.devicepolicymanager.locknow(devicepolicymanager.java:569) 03-07 12:38:33.665: error/androidruntime(806):     @ com.anquetmap.main.onclick(main.java:4 

anybody can have idea problem? appreciative.

thanks lot.

you need register deviceadminreceiver before can use device policy manager. article walks through sample on how this:

http://developer.android.com/guide/topics/admin/device-admin.html


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -