zoukankan      html  css  js  c++  java
  • 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>
  • 相关阅读:
    C# TcpServer调试工具
    C#调用百度AI开发平台
    MVC 身份证图像识别(调用dll)
    12.智能快递柜(其他功能)
    智能信报箱
    北斗卫星短信平台
    11.智能快递柜(用户寄件)
    WindowServer优化
    13.智能快递柜(对接流程)
    sublime text3 手动安装插件package control
  • 原文地址:https://www.cnblogs.com/android-zcq/p/5882012.html
Copyright © 2011-2022 走看看