Android Device Manager prevents users from deactivating

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.