在Android 4.0中如果一个程序如果只是安装了,但是重来都没有运行启动过,那么系统将会忽略这个程序,因此在系统开机时,该程序时将始终无法获取系统开机广播的---------》没有发送怎么会有接受。
因此Android 4.0及以上如果想接受系统广播至少要先运行程序一次。(其实 Android 3.1就开始了,这么说是为了针对我们开发最多android 4.0);
简单的说,这样是是为了防止开机启动恶意程序,优化启动。(防止病毒等开机启动程序危害系统,所以andoird4.0不允许没有被用户手动启动过的程序进行开机启动);
经过验证发现,系统级的应用程序是可以接收到开机启动广播的。
Android 4.0 无法接收开机广播的问题本身是因为,如果应用程序安装上始终没有被打开过,那么在Android启动时,该应用无法接收到开机时的系统广播android.permission.RECEIVE_BOOT_COMPLETED。
其实在google的android 3.1APIs更新文档中已经做了说明。
下面是引自Android官方3.1APIs说明地址 http://developer.android.com/about/versions/android-3.1.html#launchcontrols 。
原文如下(后面有对应的翻译):Launch controls on stoppedapplications
Starting from Android 3.1, the system's package manager keeps track ofapplications that are in a stopped state and provides a means of controllingtheir launch from background processes and other applications.
Note that an application's stopped state is not the same as an Activity'sstopped state. The system manages those two stopped states separately.
The platform defines two new intent flags that let a sender specifywhether the Intent should be allowed to activate components in stoppedapplication.