android开机无法自动启动,安装无法自动启动

/**
* From Android 3.1, newly installed apps are always put into a “stopped” state and the only way to move it out of the stopped
* state is to manually launch any Activity of the app at least once.
* 1) You need to design a mechanism where the user needs to first open any Activity of the app manually after installing the app.
* 2) After that, your BootReceiver will work correctly and it will be able to launch any Activity of that app automatically. Your
* implementation is absolutely correct.
* I faced the same problem in one of my apps, where I was trying to open an Activity every time the device boots but it didn’t
* work for a newly installed app. Once the user opens the app manually at least once, the app moves out of “stopped” state and
* everything works normally.
*
* EDIT
* 1) Please ensure that the is a direct child of the tag.
* 2) Please ensure that you specify android:installLocation=”internalOnly” otherwise you will not receive any Boot Complete actions if the app is installed in the SD card.
* 3) As I explained before also.
* enter image description here
* From Android 3.1, all apps are put in the stopped state which is the same as when user Force Closes any app.
* While in this state, the application will not run automatically for any reason, until and unless launched
* manually by the user from the launcher.
* Meaning you will not receive ACTION_PACKAGE_INSTALLED, BOOT_COMPLETED etc. until the user manually launches the app. Google has
* taken this decision to prevent malware apps from auto-launching. The user needs to open that app at least once, for it to perform
* actions automatically after that.
*/
在android 3.1之后,新安装的应用默认是“stop”状态,在这种状态下 ACTION_PACKAGE_INSTALLED, BOOT_COMPLETED 等系统广播都是无法接收的,只有当应用被人手动打开一次之后才能正常的接收这些广播。
下面是一个例子:
https://github.com/VenQi/BroadcastDemo

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值