Android知识总结(问答形式)一
来源:互联网 发布:射雕英雄传电视剧 知乎 编辑:程序博客网 时间:2024/06/05 06:45
- Activity和receiver的区别
- category default必须定义
- exported browsable intentfilter
Activity和receiver的区别
总感觉有点类似,但是:
Note: For all activities, you must declare your intent filters in the manifest file. However, filters for broadcast receivers can be registered dynamically by calling registerReceiver(). You can then unregister the receiver with unregisterReceiver(). Doing so allows your app to listen for specific broadcasts during only a specified period of time while your app is running.
在receiver中可以启动activity,但是不推荐。
broadcast出来的intent可以针对好多接受者,是个事件通知功能。
用intent 启动activity只能启动一个
category default必须定义?
To advertise which implicit intents your app can receive, declare one or more intent filters for each of your app components with an <intent-filter>
element in your manifest file.
To receive implicit intents, you must include the CATEGORY_DEFAULT category in the intent filter. The methods startActivity() and startActivityForResult() treat all intents as if they declared the CATEGORY_DEFAULT category. If you do not declare this category in your intent filter, no implicit intents will resolve to your activity.
那,我不定义category default的话,explicit intent不需要intent filter,而implicit intent调用的话,又调用不到。岂不是没定义category default的intent filter没用?
但是,发现打开app的第一个activity的category中没有default category,只有launcher。
The CATEGORY_LAUNCHER category indicates that this activity’s icon should be placed in the system’s app launcher. If the element does not specify an icon with icon, then the system uses the icon from the element.
所以,这就理解了,主要是系统启动应用并不是用startActivity,所以没事。
exported? browsable? intentfilter?
exported:
如果不是exported的,用root可以调用起来。
如果没有指定exported,那么有intent filter则是exported,没有就不是。
就算不是exported,也可能通过一个exported的broadcast receiver调起来,但可能性不大?
browsable:
如果定义
<intent-filter> ... <data android:scheme="https" android:host="www.example.com" /> <data android:scheme="app" android:host="open.my.app" /> </intent-filter>
那么It might seem as though this supports only https://www.example.com and app://open.my.app.
However, it actually supports those two, plus these: app://www.example.com and https://open.my.app.
所以,得分成两个intent filter写。
- Android知识总结(问答形式)一
- 保险知识问答(一)
- android ListView组件使用常见问题或形式总结(一)
- Android知识杂烩总结(一)
- android 深入浅出 群内“每日一问” 问答总结
- android 深入浅出 群内“每日一问” 问答总结(2)
- android基础知识问答总结(一)__关于Activity
- 基于知识图谱的电影自动问答系统(一)知识的获取与存储
- 基于知识图谱的电影自动问答系统(一)知识的获取与存储
- OCP考试流程分享(问答形式)
- Android引导页制作及ViewPager知识总结(一)
- 面试知识总结(一)
- SQL 知识总结(一)
- 面试知识总结(一)
- MyBatis 知识总结(一)
- 物流知识总结(一)
- jquery知识总结(一)
- Java知识总结(一)
- 数据结构 希尔排序
- 个人博客完成撒花(并没有)
- POJ
- 客户端简单位置同步
- 软件著作权申请 源代码编辑
- Android知识总结(问答形式)一
- TS流讲解--什么是ts流
- eclipse 如何向 SQL server写命令
- [HNOI2002]跳蚤 【容斥】
- Cygwin 未找到命令
- Linux系统安装Oracle 10g
- hadoop2.8.2官方文档之单节点集群
- Eclipse手动添加dtd文件使xml能自动提示
- 澳大利亚卖力推销袋鼠肉,中国吃货为什么不动心