Android / Cannot start app at boot on certain devices (e.g. Xiaomi)

1.5k views Asked by At

I followed all the guidance found on SO to autostart app at boot time.

In my manifest, I have set the right permission (RECEIVE_BOOT_COMPLETED) and also declared my broadcast receiver: .BootReceiver picking up Android.Intent.Action.BOOT_COMPLETED.

I also launch my service in BootReceiver, this is very straightforward stuff.

The thing is, my app starts at boot time on certain devices (I hope most devices) but not on some of them. I have a Xiaomi phone that gives me the following error at boot time:

"Unable to launch app com..example/10120 for broadcast Intent {act=android.intent.action.BOOT_COMPLETE flg=0x8000010 (has extras) }: process is not permitted to autostart."

I am surprised to see this message, because I can see that the list of permissions includes running at startup.

There must be a way, because Whatsapp for instance is launched at boot time.

Any clue would be highly appreciated.

1

There are 1 answers

0
kris ho On

Same here. I tried to delete the file in the SD card ( but the system direct to internal storage ) by using the permission WRITE_EXTERNAL_STORAGE, and get the similar message from log-cat. Maybe it can be fixed by rooting the xiao-mi mobile, that's what I searched from the Internet.