1、Intent中只能包含一个Action,可以包含多个Category;
2、清单文件中一个Activity可配置多个IntentFilter, 一个IntentFilter可包含多个
Action,多个Category,但是只能包含一个data;
3、Intent若含有Action,IntentFilter中包含多个Action,只要Intent中的Action与IntentFilter中的任一一个Action匹配,则算匹配成功;
4、Intent中若含有category,则这些category必须属于intentFilter中的category的子集,不管intentFilter中配置了多少category,Intent只需携带其子集数量的category即可匹配。
PS:IntentFilter中必须包含:<categoryandroid:name="android.intent.category.DEFAULT"/>因为使用隐式意图的Intent中会添加默认的Category,即上图中的category值,如IntentFilter中不添加上图的Category,则匹配不成功,会爆出android.content.ActivityNotFoundException: No Activity found to handle Intent { act=xxxxxxxx }异常,但是我其实不太明白,为什么入口Activity中不需要这个默认的Category,希望有知道的能提点一下。
5、若清单文件中一个Activity配置了多个IntentFilter,Intent只需与其中一个IntentFilter中的内容相匹配即可,但不可跨越多个IntentFilter去匹配。
6、Data包含Scheme,Host,Port,Path和Type五部分,Intent中Data和Type是分开设置的,且会按照设置顺序后设置Type或Data会覆盖前设置的Data或type,如果要让Intent中Data和Type共同存在需要使用setDataAndType(Uri data,String type);的API同时设置。Intent中的Data的5个组成部分必须是IntentFilter中5个部分的自己,才算匹配。
参考文章:http://blog.youkuaiyun.com/cnnumen/article/details/8464786
http://blog.youkuaiyun.com/mynameishuangshuai/article/details/51673273