这个问题在堆栈溢出中被问过几次,但还没有解决方案。
我有一个广播接收器,用于接收 USB 连接操作。广播接收器的责任是,如果我得到意图启动我的应用程序。在清单文件中,我添加了接收器。我在 GingerBread 中也有同样的逻辑,但 ICS 它不起作用。许多问题,例如,广播不调用 https://stackoverflow.com/questions/9596579/broadcastreciever-not-working-while-phone-is-booting-in-android
1 https://stackoverflow.com/questions/9596579/broadcastreciever-not-working-while-phone-is-booting-in-android: Android 启动广播未调用 https://stackoverflow.com/questions/9426189/android-boot-up-broadcast-not-invoking and 广播接收器不工作 https://stackoverflow.com/questions/9596579/broadcastreciever-not-working-while-phone-is-booting-in-android
如果我手动启动我的应用程序一次,那么从下次连接 USB 时起,我的应用程序将自动启动。
试图回答同样的问题但没有答案。
ICS中有没有解决这个问题的方法?
这是我的接收器
<receiver android:name="com.test.MyReceiver">
<intent-filter>
<action android:name="android.hardware.usb.action.USB_STATE" />
<action android:name="android.net.wifi.STATE_CHANGE" />
<action android:name="android.net.wifi.WIFI_STATE_CHANGED" />
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>
</receiver>
and this is my class
public class MyReceiver extends BroadcastReceiver {
.
.
.
public void onReceive(Context context, Intent intent) {
.
我有什么地方说错了吗?
提前致谢
——科兹洛夫
ICS中有没有解决这个问题的方法?
它工作正常。从 Android 3.1 开始,没有BroadcastReceiver
将一直工作,直到用户手动启动活动。我八个月前在博客上写过这个 http://commonsware.com/blog/2011/07/13/boot-completed-regression-confirmed.html.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)