我正在 Android 4.0.3 中开发应用程序。根据Google 的文档,我读到不再支持 HONEYCOMB BOOT COMPLETED 事件。
鉴于此,我怎样才能发现我的设备已重新启动?
代码 -
Java类:-
public class MyStartupIntentReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
Logger.i("Device", "REBOOT");
Logger.i("Device", "REBOOT");
Logger.i("Device", "REBOOT");
Logger.i("Device", "REBOOT");
Logger.i("Device", "REBOOT");
}
}
清单文件:-
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<receiver android:name="MyStartupIntentReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</receiver>