Android Question [SOLVED] Does Device Administrator Library need an Activity ?

lemonisdead

Well-Known Member
Licensed User
Longtime User
Hello,
I am referring to that library : https://www.b4x.com/android/forum/threads/device-administrator-library.19208/

My need was to block an app uninstallation. I have seen that Administrators apps won't be uninstalled simply till they are (asking for the user to disable them, etc.).
My idea was to receive the "Disabled" action and after a small delay reenable the app as an Administrator.

It works when done from an activity but not from a service where I get an error (log attached because when I paste the lines they are down to top reversed). But the main error is
B4X:
java.lang.NullPointerException

What I have tried is to move the Manager declaration in the service but it does not work (project attached).

Do you have any idea about ? Many thanks
 

Attachments

  • log.txt
    2.5 KB · Views: 258
  • admMgr.zip
    8.5 KB · Views: 269
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
SS-2016-02-02_08.17.13.png


The Enable method must be called from an activity.
 
Upvote 0
Top