After the android phone is successfully unlocked, the android receives the system lock screen broadcast, and the higher version sends the broadcast

1. In the high version, users send custom broadcasts, but cannot receive information

Intent intent = new Intent();

intent.setAction("demo.destroy");

intent.setComponent( new ComponentName( "luoy.com.servicebackstage" ,

"luoy.com.servicebackstage.MyReceiver"));

sendBroadcast (intent);

Two parameters of setComponent, the first is the package name, the second is the path of Receive

2. The system broadcast cannot be received

Some special broadcasts must be registered dynamically, static registration has no effect

Similar, lock screen and open screen of the screen

IntentFilter recevierFilter=new IntentFilter();

recevierFilter.addAction(Intent.ACTION_SCREEN_ON);

recevierFilter.addAction(Intent.ACTION_SCREEN_OFF);

MyReceiver receiver=new MyReceiver();

registerReceiver(receiver, recevierFilter);https://blog.csdn.net/qq_30711091/article/details/86657268

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324125345&siteId=291194637