一、BroadcastReceiver静态注册
1、静态注册在AndroidManifest.xml文件中进行配置
<receiver android:name="com.zqc.camera.BootBroadcast" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
2、创建一个BootBroadcast类继承BroadcastReceiver,在系统开机的时候会接收到一个开机广播
public class BootBroadcast extends BroadcastReceiver {
private static final String TAG = "BootBroadcast";
@Override
public void onReceive(Context context, Intent intent) {
if (null != intent) {
String action = intent.getAction();
Log.d(TAG, "onReceive()");
if (Intent.ACTION_BOOT_COMPLETED.equals(action)) {
}
}
}
}