Difference between BOOT_COMPLETED and QUICKBOOT_PO

2019-03-11 08:07发布

问题:

I have created BroadcastReceiver to schedule my Service execution every 30 seconds. This is what I have in AndroidManifest.xml :

<receiver android:name="MyScheduleReceiver" >
     <intent-filter>
          <action android:name="android.intent.action.BOOT_COMPLETED" />
          <action android:name="android.intent.action.QUICKBOOT_POWERON" />
     </intent-filter>
</receiver>

This is working great now, but only after I added QUICKBOOT_POWERON action. Before that I had only BOOT_COMPLETED and when I reboot emulator or phone while debugging, my service would never start. So my question is what is the difference between these two and when to use each?

回答1:

Intent android.intent.action.BOOT_COMPLETED is received after a "cold" boot.

Intent android.intent.action.QUICKBOOT_POWERON is received after a "restart" or a "reboot".

Check here