我正在开发Android中4.0.3应用程序。 我读过蜂窝结束启动事件不再支持,根据谷歌的文档 。
鉴于此,我怎么能发现我的设备重新启动?
CODE -
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>