admin管理员组文章数量:1623788
网上不少文章中都写到这样一种方法,提升service的优先级别能够用android:priority = “1000” 的方式来提供servie 的存活时间。其实这是一种没有效果的作法(具体作法可参考service可否实现不被kill)html
关于priority 这个属性的描述 ,google 官方文档以下:java
android:priority
The priority that should be given to the parent component with regard to handling intents of the type described by the filter. This attribute has meaning for both activities and broadcast receivers:
It provides information about how able an activity is to respond to an intent that matches the filter, relative to other activities that could also respond to the intent. When an intent could be handled by multiple activities with different priorities, Android will consider only those with higher priority values as potential targets for the intent.
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.
Also see setPriority().
1. 优先级的概念用于描述控件的 intent的filter的类型。 这个属性只对activity 和 receivers 是有意义的。
2. 隐式调用activity的状况下: 若是多个activity 知足响应 的条件, 系统只会触发 priority 高的那个activity。android
3. 有序广播发出的状况下:若是多个receiver知足响应的条件,系统会优先触发prioriyt搞的那个receiver。app
4. priority 必须是整数,默认是0 范围是[-1000, 1000]less
本文标签: 含义androidPriorityIntentFilter
版权声明:本文标题:android:priority= 1是什么意思,IntentFilter 中 的android:priority 的含义 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dianzi/1728895508a1178356.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论