- @author android_ls
*/
public class BootBroadcastReceiver extends BroadcastReceiver {
private static final String TAG = "BootBroadcastReceiver";
private static final String ACTION_BOOT = "android.intent.action.BOOT_COMPLETED";
@Override
public void onReceive(Context context, Intent intent) {
Log.i(TAG, "Boot this system , BootBroadcastReceiver onReceive()");
if (intent.getAction().equals(ACTION_BOOT)) {
Log.i(TAG, "BootBroadcastReceiver onReceive(), Do thing!");
}
}
}
3、在AndroidManifest.xml文件里注册广播接收器
<intent-filter >
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</receiver>