I have created an android application with device admin rights. It was working properly on my Moto G and many other devices. In Sony Xperia C, the device administrator rights disabled automatically on phone restart. Is anyone come across such issue? and how to fix them?
Asked
Active
Viewed 1,487 times
2 Answers
1
There may be other ways of doing it, but what springs to mind is a startup script. There's an interesting article here on creating them, which you might use to automatically set admin permissions to your app.

Wolfish
- 960
- 2
- 8
- 34
-
This doesn't solve my issue. Because, we can't ask the user to install another application. – venkat Aug 23 '14 at 12:59
-
I've got a similar problem with my app on the Sony Xperia C. Does anybody know why this happens? How to solve it? – BlokeTech Sep 20 '14 at 08:26
-
@Charles-BlokeTech If you have the stock OS installed, there is the possibility of your provider disabling root access upon each restart, likely through a script of a similar nature. Solution? Get a custom ROM. Take a look at CyanogenMod, for example. – Wolfish Sep 22 '14 at 11:08
-
Root access has nothing to do with this problem. – BlokeTech Sep 25 '14 at 04:05
-
@venkat You don't need another application to use a script, you simply need to have access to `init.d`. AFAIK, this is already programmatically available. Also, you could use another application by allowing a silent install - using `android.permissions.INSTALL_PACKAGES` and chmod your signature certificate with 777. – Wolfish Sep 25 '14 at 09:12
0
My app had a similar problem on this phone and I think I've worked out what is happening.
If the user moves the app from internal memory to the SD card, the app can lose its Device Administrator privileges when the SD card is unmounted. This would likely happen when the phone is restarted.
According the Android documentation, if you don't specify an installLocation in the manifest, an app should not be moveable. I think some phones break this rule and allow an app to be moved anyway.

BlokeTech
- 317
- 1
- 7
-
Actually, it was not only occurring after moving the application. It happens while using the app for sometime or if some other app also gets device admin privilege. – venkat Sep 21 '14 at 16:54
-
Not sure what other triggers there could be, but good luck. Moving the app back solved the issue for me - hopefully it helps others. – BlokeTech Sep 25 '14 at 04:07