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

Raheel Shahzad picture Raheel Shahzad · May 27, 2014 · Viewed 8.5k times · Source

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)

Answer

betorcs picture betorcs · May 27, 2014

Make sure you have setup the correct permission for your DeviceAdminReceiver implementation class and it's checked as App Administrator in Settings

enter image description here

<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