What is the integer value that gives a broadcast receiver highest priority?

前端 未结 6 1701
旧巷少年郎
旧巷少年郎 2020-12-16 14:51

What is the integer value the gives a broadcast receiver the highest priority?


  

        
6条回答
  •  独厮守ぢ
    2020-12-16 15:41

    Well, according to the documentation

    "The value must be an integer, such as "100". Higher numbers have a higher priority."
    

    So I'm guessing that any integer value is valid. And the highest priority possible would be the maximum integer that android allows, which is (2^31 - 1).

    EDIT

    The documentation has been updated, and it now explicitly states which priority values may be used by applications. The documentation now says

    SYSTEM_HIGH_PRIORITY (1000): Applications should never use filters with this or higher priorities. SYSTEM_LOW_PRIORITY (-1000): Applications should never use filters with this or lower priorities.

    Implying that your application is permitted to use integer priority levels between -999 and 999.

提交回复
热议问题