App doesn't auto-start an app when booting the device in Android

本文介绍了从Android 3.1开始,新安装的应用默认处于停止状态的问题,并提供了解决方案:用户首次手动打开应用后,后续通过BootReceiver可以正常启动应用。文章还给出了实现该功能的具体建议。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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.

For your problem,

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 <uses-permission> is a direct child of the <manifest> 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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值