Solve the method that the phone management tool does not disable boot

Source: Internet
Author: User

Many of the tools on the market now have the ability to block other apps from booting, such as the Cheetah Cleanup Master and 360 security guards. This article explains how to avoid being a cheetah cleanup master closed the boot broadcast, 360 security guard Shield mode has not been clear, there are Daniel understand the words please enlighten.

The cheetah blocking principle is achieved by changing the state of the third-party app to receive the reciver of the boot broadcast. The solution is to change the power to be available in the shutdown broadcast.

The specific code is as follows:

Receive the boot broadcast Android.intent.action.BOOT_COMPLETED the build name is Com.android.test.CompletedReciver.java

Receive shutdown broadcast Android.intent.action.ACTION_SHUTDOWN The build name is Com.android.test.ShutDownReciver.java

Package com.android.test;


import android.content.BroadcastReceiver;

import android.content.ComponentName;

import Android.content.Context;

import android.content.Intent;

import Android.content.pm.PackageManager;

import android.text.TextUtils;


Public class Shutdownreceiverextends broadcastreceiver {


Private Static void setcomponentenablesetting (context context, String ClassName) {

Packagemanager pm = Context.getpackagemanager ();

ComponentName componentname = new componentname (context, className);

Pm.setcomponentenabledsetting (ComponentName, Packagemanager. Component_enabled_state_enabled, Packagemanager. Dont_kill_app);

}


Private Static int getcomponentenablesetting (context context, String ClassName) {

Packagemanager pm = Context.getpackagemanager ();

ComponentName componentname = new componentname (context, className);

return pm.getcomponentenabledsetting (componentname);

}


@Override

Public void onreceive (final context context, Intent Intent) {

String action = Intent.getaction ();

if (Textutils.isempty (Action)) {

return;

}

if (Intent. action_shutdown. Equals (ACTION)) {

String componentname = "Com.android.test.CompletedReciver";

if (Packagemanager. component_enabled_state_disabled = = getcomponentenablesetting (Context.getapplicationcontext (), ComponentName)) {

Setcomponentenablesetting (Context.getapplicationcontext (), componentname);

}

}

}

}


About 360 security guard and MIUI system the implementation of the Security Center has not been understood.

Solve the method that the phone management tool does not disable boot

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.