android.intent.category.BROWSABLE
参考:
http://blog.csdn.net/annkie/article/details/8349626
http://xiechengfa.iteye.com/blog/1004991
BROWSABLE的意思就是浏览器在特定条件下可以打开你的activity:
举例1:
我有一个activity,它注册了能显示pdf文档,AndroidManifest.xml内容如下:
<intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="http" android:mimeType="application/pdf"/> </intent-filter>
你在浏览器中输入 http://www.devdiv.com/1.pdf ,那么这个activity自动被浏览器给调起来。
类似我们注册了一个数据类型,指定默认打开这个数据类型的应用程序
举例2: 开源中国的
<activity android:name=".ui.MainActivity" android:launchMode="singleTask" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.DEFAULT" /> <data android:host="www.oschina.net" android:scheme="http" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.DEFAULT" /> <data android:host="www.oschina.net" android:scheme="https" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.DEFAULT" /> <data android:host="my.oschina.net" android:scheme="http" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.DEFAULT" /> <data android:host="my.oschina.net" android:scheme="https" /> </intent-filter> </activity>
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步