android - 请问和某个intent匹配的程序列表的排序先后有什么依据?能改变吗?
巴扎黑
巴扎黑 2017-04-17 11:32:31
0
1
697

请问和某个intent匹配的程序列表的排序先后有什么依据?能改变吗?

巴扎黑
巴扎黑

reply all(1)
洪涛

When the component management service receives the Intent of the requested component (set to intentA), it first checks whether the intentA object contains Component information. If so, there is no need to match it.
If not, the Intent Filter information of all components will be obtained from the application management service and compared with the intentA target.

The comparison algorithm is as follows:

1) Compare Action. If intentA does not contain Action, or all Inent Filters in the system do not have a matching Action, go to 2);

2) Compare Data and Type
2-1) If there is no Data or Type item in intentA, then there cannot be one in Intent Filter, otherwise the matching will fail;
2-2) If intentA contains Type, the Type of Intent Filter must correspond to it (wildcard comparison can be used), otherwise the comparison fails;
2-3) If intentA contains Data, the URI information of Data will be split into Scheme and Authority parts, and compared with the corresponding parts in the Intent Filter object one by one. The two must be completely equal before the match can be successful.
If both 1) and 2) match successfully, enter 3)

3) Match Category. If intentA has no Category, it will succeed; otherwise, all Categories contained in intentA must appear in the Category of the corresponding Intent Filter. Otherwise, the match will fail, that is, only if the Category item collection of the intntA object Matching can only be successful when it is a subset of the Catetory item collection of the Intent Filter object.

For details, please refer to Chapter 4, Section 2 of "Android Development Essentials".

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template