Reputation: 156
I wants to wipe data remotely using my app but currently I am trying to do it manually from app. But When I try to use wipe data method, It shows security Exception. I have tried to force lock and it shows positive results but give exception during wipe data. Please help me. Thanks.
This is the stack trace
java.lang.SecurityException: No active admin owned by uid 10047 for policy #4
at android.os.Parcel.readException(Parcel.java:1425)
at android.os.Parcel.readException(Parcel.java:1379)
at android.app.admin.IDevicePolicyManager$Stub$Proxy.wipeData(IDevicePolicyManager.java:1553)
at android.app.admin.DevicePolicyManager.wipeData(DevicePolicyManager.java:1082)
at com.test.WipeActivity$1.run(WipeActivity.java:54)
at java.lang.Thread.run(Thread.java:856)
Upvotes: 2
Views: 10311
Reputation: 156
Here is the xml file
<device-admin xmlns:android="schemas.android.com/apk/res/android">
<uses-policies>
<force-lock />
<wipe-data />
</uses-policies>
</device-admin>
Change the access modified to Public
in your receiver class. Make it sure that your receiver class and method are public. If anybody still face any issue after this then let me know.
Upvotes: 0
Reputation: 2821
Make sure you have setup the correct permission for your DeviceAdminReceiver
implementation class and it's checked as App Administrator in Settings
<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
<uses-policies>
<wipe-data />
</uses-policies>
</device-admin>
For more info follow this guide http://developer.android.com/guide/topics/admin/device-admin.html
Upvotes: 2