0

I'm using in my app Device Admin API but it requires actions from user to enable it - I was wondering that is it somehow install app and automatically enable admin on it without asking user?

Does anyone tried to do something like this

Robert
  • 1,272
  • 4
  • 21
  • 40

6 Answers6

1

Enable Device Admin without asking user

Not a good idea. If that would allowed by android then anyone can play with users and user's data. Android not allowed , not allowing and will not allow this thing in future. You better stop wondering ;)

dharmendra
  • 7,835
  • 5
  • 38
  • 71
  • I do not agree with you in some cases it's just required. – Robert Sep 22 '14 at 12:07
  • If you required then user must know that thing. Let the user know and use that property – dharmendra Sep 22 '14 at 12:11
  • Ok let's ask in other way. I need to disable buttons clear data and force stop on that app do you know how? – Robert Sep 22 '14 at 12:18
  • 1
    For clearing data, just delete your database, SharedPreferences you can use the clear function from ``SharedPreferences.Editor``. Why would you want to force stop an app, that is not best practice for Android as Android is supposed to decide when an app should be stopped, not the developer. The developer just finishes the activity, not exit the process. – Boardy Sep 22 '14 at 12:25
  • 1
    @Robert you can not do this thing unless you decide to lunch your own hardware powered by android os. that option is only for system apps like Mediaprovider. – dharmendra Sep 22 '14 at 12:57
  • @Boardy I do not want to clear data I want to AVOID IT. – Robert Sep 22 '14 at 13:04
  • @dhams let's say that it should work as system app but on all devices no matter who is hardware provider. – Robert Sep 22 '14 at 13:05
  • Sorry, I misread your comment. You can't disable those buttons, maybe the device admin can I'm not too sure what exactly that provides, but if it does you will still need to get the user to authorise the app to be a device admin. As @dhams said the other way is to be a system app but you can only be a system app, if the app was baked into the ROM, therefore would actually need to make your own ROM with your app embedded and release the ROM instead. Although probably not what you want to consider doing. – Boardy Sep 22 '14 at 13:12
0

This is not possible because of OS security

Palak
  • 2,165
  • 2
  • 21
  • 31
0

This isn't possible, the device admin provides certain rights to the device for an app, that a standard app does not have. It would be a huge security risk if the user installed an app and it automatically set itself as a device admin without the users consent or knowledge.

Boardy
  • 35,417
  • 104
  • 256
  • 447
0

There is no way to enable or disable Device Admin without asking the user for security purposes.

gilonm
  • 1,829
  • 1
  • 12
  • 22
0

OK after long time I have to say that it's impossible to do it without OS moddification. Even I have tried to use Android hidden API by reflection but then looks that you need some system permission.

Robert
  • 1,272
  • 4
  • 21
  • 40
  • This is exactly my case - I'm building a custom Android ROM, and I want to install an app as system one. It uses Device Admin API and shows that very prompt, even it is signed with system certificate. I'm looking for a way to remove that prompt via some kind of system API or something. I can hack Device Admin source code to not show the prompt, but I'm checking if there may be a special API for that... – Mixaz May 11 '17 at 19:43
0

Use dpm set-active-admin, if you have root or system/signature privileges.

Usman Khan
  • 3,739
  • 6
  • 41
  • 89