The scheme is tested and the system version 4.4.2. It's a bug with the Android system and is not sure if it's fixed in later versions.
This function is the same as the 360 anti-unloading function of the principle of implementation.
The main references are: http://bbs.pediy.com/showthread.php?t=193123
public class Mantaadminreceiver extends Deviceadminreceiver { @Override public void OnReceive (context context, Intent Intent) { super.onreceive (context, Intent); } @Override ondisablerequested(context context, Intent Intent) { return "some message"; }
When a user deactivates an app in the Settings app, a confirmation box pops up.
When the confirmation box pops up, the ondisablerequested () method in the code above is called, and in this step we put our own code to prevent the popup from succeeding, and the action to prevent the user from deactivating has been met.
The alert message that the Device Manager pops up dialog disappears through activity switching. Make the user unable to manipulate dialog.
In ondisablerequested, different ways are used to make the user unable to operate the interface within 5 seconds. The activity switch request will be executed by the system after 5 seconds.
Three scenarios:
1. Call the lock screen
2. Blocking
3. Suspension frame Windowmanager.addview ()
Android Device Manager prevents users from deactivating