h5唤醒App

一、应用场景

用户在访问我们的网页时,判断出这个用户手机上是否安装了我们的App,如果安装了则直接从网页上打开APP,否则就引导用户前往下载,从而形成一个推广上的闭环。这里只针对从网页端打开本地APP。

二、APP端配置

<activity
    android:name=".ui.activity.ZMCertTestActivity"
    android:label="@string/app_name"
    android:launchMode="singleTask"
    android:screenOrientation="portrait">
    <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="scheme1"
            android:host="host1"
            android:path="/path1"
            android:port="8080" />
    </intent-filter>
</activity>

WEB端通过调用“scheme1://host1:8080/path1?query1=1&query2=true“便能打开这个Activity。其中scheme和host是必须的,另外的看需求。

三、通过WEB端打开

<!DOCTYPE html>
<html>
<head>
    <title>test</title>
</head>
<body>
    <a href="scheme1://host1:8080/path1?query1=1&query2=true">打开APP</a>
</body>
<html>



原文地址:https://www.cnblogs.com/fger/p/12010251.html