问题
I have created an application that receives BOOT_COMPLETED within a receiver using the following filter:
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
I receive this on one device but I have another device that does not receive this despite using the same APK. What device-specific issues could prevent a particular device from receiving this intent? Is there any way to test for this and create a remedy?
回答1:
Make sure that you are doing a real full reboot.
Some HTC devices, for example, have a "fast boot" mode that does not trigger BOOT_COMPLETED
, but instead sends an android.intent.action.QUICKBOOT_POWERON
broadcast. As I understand it, the "fast boot" mode basically does a hibernate, instead of a true power down, and so they don't send BOOT_COMPLETED
as a result.
(why the Intent
action isn't com.htc.action.QUICKBOOT_POWERON
is a whole `nuther issue...)
回答2:
Some devices after Android 3.1 will not give the app control after the BOOT_COMPLETED receiver.
Google has long said that users should launch an activity from the launcher first, before that application can go do much. Preventing BOOT_COMPLETED from being delivered until the first activity is launched is a logical extension of the same argument.
I do not know which devices it makes a difference on though.
来源:https://stackoverflow.com/questions/17221679/boot-completed-intent-not-received-on-all-devices