Please put all of this code in the same app.  Seriously.  The ability to
wipe data in severe.  Keep all the code around controlling it in the same
app and as isolated and protected as possible from any other app.  You are
taking on a serious responsibility when being a device admin like this.
 This isn't the place to play tricks with how you can separate your
implementation across apps.

On Wed, Jan 19, 2011 at 1:57 PM, kl4232 <klavin4...@yahoo.com> wrote:

> Hi
> I have 2 apps. One is a regular app with a UI. I've made it a device
> administrator which has been granted the wipeData permission.
> The other is a service, with no UI. I want to call wipeData() from my
> service.
>
> If I simply call
>
> DevicePolicyManager dpm =
>
> (DevicePolicyManager)context.getSystemService(Context.DEVICE_POLICY_SERVICE);
> dpm.wipeData(0);
>
> from my service app I get a security exception....
>
> java.lang.SecurityException: No active admin owned by uid 10033 for
> policy #4
>
> If I sign both the regular app and the service app with the same
> signature and have the same sharedUserId in both of their manifests...
> android:sharedUserId="com.myapps.shared"
> Then they both appear as device administrators in the Settings app. I
> can present the device administrator screen easily to the user for the
> regular app but for the service it ends up having to be as a
> notification and users may miss it.
>
> Q: Is there any way to have my regular app be a device administrator
> and for the service app to leverage off that and call wipeData(),
> without the user having to specifically grant permissions for the
> service app.
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to