Android Html 调用本地应用程序

1、创建 Html:

<html>

    <head>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
        <title>Html 调用本地应用程序</title>

    </head>

    <body>

        <a href="m://my.com/">打开本地app</a>

    </body>

</html>

2、配置应用程序:在AndroidManifest的清单文件里的intent-filter中加入如下元素:

<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:host="my.com" android:scheme="m" />
</intent-filter>

注意:一定要 加入一条新的 intent-filter,否则将会出现 找不到页面。

发表评论