The use and configuration of Android power on broadcast

  • 2020-05-09 19:17:07
  • OfStack

Related articles Android 4.0 could not receive power on broadcast
Register receiver with the system in the configuration file AndroidManifest.xml, and the child node intent-filter receives the android.intent.action.BOOT_COMPLETED message
 
<receiver android:name="com.ray.ray.receiver.BootCompletedReceiver" > 
<intent-filter> 
<action android:name="android.intent.action.BOOT_COMPLETED" /> 
</intent-filter> 
</receiver> 

You also need to add the appropriate permissions
 
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> in Receiver You can add the operation needed to boot  
public class BootCompletedReceiver extends BroadcastReceiver { 
@Override 
public void onReceive(Context context, Intent intent) { 
// TODO Auto-generated method stub 
} 

Related articles: