BroadcastReceiver for BOOT_COMPLETED is too slow

前端 未结 2 806
醉梦人生
醉梦人生 2021-02-14 12:57

The below is my manifest file.

    
    

        
2条回答
  •  天命终不由人
    2021-02-14 13:39

    There will be some system resources that need to boot first and will have a higher priority over your receiver. However you could try setting a priority to your intent in the manifest. Like so:

    
        
        
    

    Please have a look at the details from the developer docs regarding this: Docs

    Extract regarding priority:

    It controls the order in which broadcast receivers are executed to receive broadcast messages. Those with higher priority values are called before those with lower values. (The order applies only to synchronous messages; it's ignored for asynchronous messages.)

    Use this attribute only if you really need to impose a specific order in which the broadcasts are received, or want to force Android to prefer one activity over others.

    The value must be an integer, such as "100". Higher numbers have a higher priority. The default value is 0. The value must be greater than -1000 and less than 1000.

提交回复
热议问题