什么是整数值,给出了一个广播接收机优先级最高的出了、接收机、优先级、整数

2023-09-06 02:14:22 作者:南辰浅巷

什么是整数值给出一个广播接收器的最高优先级

 <意图过滤器的Andr​​oid版本:优先级=1>
       <作用机器人:名称=android.provider.Telephony.SMS_RECEIVED/>
      &所述; /意图滤光器>
 

解决方案

那么,根据documentation

 的值必须为整数,如100,数值越大,有更高的优先级。
 

所以,我猜测任何整数值是有效的。与最高优先级的可能将是最大整数机器人允许,其为(2 ^ 31 - 1)。

性能与体验的双向满级 荣耀猎人游戏本V700详尽拆评

修改

该文档已被更新,现在明确规定其优先级值可以使用的应用程序。文档现在说

  

SYSTEM_HIGH_PRIORITY(1000):应用程序不应该使用的过滤器   与此或更高的优先级。   SYSTEM_LOW_PRIORITY(-1000):应用程序不应该使用的过滤器   与此或更低的优先级。

难不成您的应用程序允许使用-999和999之间的整数的优先级。

what is the integer value the gives a broadcast receiver the highest priority

 <intent-filter android:priority="1">
       <action android:name="android.provider.Telephony.SMS_RECEIVED" />
      </intent-filter>     

解决方案

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.