Android html 超链接 启动app应用

来源:互联网 发布:数组按元素次数排序php 编辑:程序博客网 时间:2024/05/13 12:08

AndroidMenifest.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="myapp" />
            </intent-filter>

Launcher Activity code

        //取得URL所带进来的Intent对象
        Intent tIntent = this.getIntent();
        //取得Schema,值为:myapp
        String tSchema = tIntent.getScheme();
        //取得URL
        Uri myURI = tIntent.getData();
        String tValue = "";
        if (myURI != null) {
            //取得URL中的Query String参数
            tValue  = myURI.getQueryParameter("id");
        }
        LogProxy.d(TAG, "my id=" + tValue);

html:


<html xmlns="http://www.w3.org/1999/xhtml">
     <body>
     <a id="open" href="hwy://demo?id=799KK3at&snsType=WEIXIN_SECRET_SHARE&openId=null&type=SHARE">open it
     </body>
</html>




0 0
原创粉丝点击