简体   繁体   中英

java.lang.SecurityException: No active admin owned by uid 10047 for policy #4 on wipe data

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)

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM