lemonisdead Well-Known Member Licensed User Longtime User Feb 1, 2016 #1 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 Code: Copy 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 log.txt 2.5 KB · Views: 549 admMgr.zip admMgr.zip 8.5 KB · Views: 521 Last edited: Feb 1, 2016
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 Code: Copy 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
Erel B4X founder Staff member Licensed User Longtime User Feb 2, 2016 #2 The Enable method must be called from an activity. Upvote 0
lemonisdead Well-Known Member Licensed User Longtime User Feb 2, 2016 #3 I'm terribly sorry.. Thanks again Upvote 0