我怎样才能找到我的设备重新启动,因为蜂窝结束启动不再支持? [英] How can I discover that my device has rebooted, given that HONEYCOMB BOOT COMPLETED is no longer supported?
问题描述
我正在开发在Android中4.0.3应用程序。我读过蜂窝结束启动事件不再支持,根据谷歌的文档。
鉴于此,我怎么能发现我的设备重新启动?
code -
Java的类: -
公共类MyStartupIntentReceiver扩展的BroadcastReceiver {
@覆盖
公共无效的onReceive(上下文的背景下,意图意图){
Logger.i(设备,重新启动);
Logger.i(设备,重新启动);
Logger.i(设备,重新启动);
Logger.i(设备,重新启动);
Logger.i(设备,重新启动);
}
}
清单文件: -
<使用-权限的Android:名称=android.permission.RECEIVE_BOOT_COMPLETED/>
<接收器的Android版本:NAME =MyStartupIntentReceiver>
<意向滤光器>
<作用机器人:名称=android.intent.action.BOOT_COMPLETED/>
<类机器人:名称=android.intent.category.HOME/>
&所述; /意图滤光器>
< /接收器>
抱歉,但也许你是错的文件,任何方式确保你包括<使用-许可安卓名=android.permission.RECEIVE_BOOT_COMPLETED/>
许可,您的清单。我在许多应用程序使用的广播和他们的伟大工程。
请确保你知道aslo这个信息 BOOT_COMPLETE
发送到应用程序的外部存储设备安装前。因此,如果应用程序安装到外部存储它不会收到 BOOT_COMPLETE
广播消息。
I am developing app in Android 4.0.3. I've read that the HONEYCOMB BOOT COMPLETED event is no longer supported, according to Google's documentation.
Given this, how can I discover that my device has rebooted?
CODE -
Java Class :-
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");
}
}
Manifest File :-
<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>
sorry , but perhaps you are wrong about the documentation , any way make sure that you are including <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
permission in your manifest . I use this broadcast in many apps and they works great.
Make sure you know aslo about this info BOOT_COMPLETE
is sent to applications before external storage is mounted. So if application is installed to external storage it won't receive BOOT_COMPLETE
broadcast message.
这篇关于我怎样才能找到我的设备重新启动,因为蜂窝结束启动不再支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!