我期待我的应用程序加载BroadcastReceiver AutoStartOnBoot当我重新启动我的设备。奇怪BOOT_COMPLETED行为
- 我卸载并安装该应用程序。这意味着所有现有设置都将被删除。然后我关掉手机。并重新启动它,广播接收器永远不会被调用。
- 我现在再次关闭设备电源并重新上电。但是,广播接收器不被调用。
- 我现在启动应用程序一次。清除数据。并关闭它。我给它启动。现在,广播接收器被调用。
清单
<receiver
android:name=".AutoStartOnBoot"
android:enabled="true"
android:exported="true"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
我有权限设置
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
http://stackoverflow.com/questions/11246326/how-to-receiving-broadcast-when-application-installed-or-removed – 2014-11-06 11:19:15