android - Delete the application data by setting device administor active -
i want delete application data , trying activating device administrator active .
public class appclass extends activity{ ...... case r.id.buttonclear: if (!mdpm.isadminactive(mdeviceadmin)) { intent intent = new intent(devicepolicymanager.action_add_device_admin); intent.putextra(devicepolicymanager.extra_device_admin, mdeviceadmin); intent.putextra(devicepolicymanager.extra_add_explanation, "process remove user installed applications, settings, wallpaper , sound settings. sure want wipe device?"); mparentfragment.startactivityforresult(intent, request_code_enable_admin); system.out.println("\n in device admin cannot security operations "); } else { // device administrator, can security operations system.out.println("\n in device admin can security operations "); mdpm.wipedata(0); } ..... public class myadmin extends deviceadminreceiver{ public myadmin() { // todo auto-generated constructor stub } } } manifest.xml: <receiver android:name="com.app.ui.appclass$myadmin" android:permission="android.permission.bind_device_admin"> <meta-data android:name="android.app.device_admin" android:resource="@xml/myresxml" /> <intent-filter> <action android:name="android.app.action.device_admin_enabled"/> </intent-filter>
when click on activate in device administer pop , app crashes following error
newinstance failed: no <init>() d/androidruntime(10623): shutting down vm w/dalvikvm(10623): threadid=1: thread exiting uncaught exception (group=0x40a481f8) e/androidruntime(10623): fatal exception: main e/androidruntime(10623): java.lang.runtimeexception: unable instantiate receiver com.app.ui.appclass$myadmin: java.lang.instantiationexception: can't instantiate class com.app.ui.appclass$myadmin; no empty constructor
Comments
Post a Comment