在AndroidManifest.xml文件新增intent-filter
標(biāo)簽记靡,如下:
<!--自定義scheme 用于調(diào)起APP -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Add optional android:host to distinguish your app
from others in case of conflicting scheme name -->
<data android:scheme="scheme" android:host="www.wodeyuming.com" />
<!-- <data android:scheme="sample" /> -->
</intent-filter>
測(cè)試Deeplink是否生效:
1.新建html文件
2.粘貼如下內(nèi)容到html文件中
<!DOCTYPE html>
<head>
<meta charset="UTF-8" />
<meta id="viewport" name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,minimal-ui">
</head>
<html>
<input type="button" value="點(diǎn)擊我打開(kāi)Deeplink" onclick="javascrtpt:window.location.href='scheme://www.wodeyuming.com/'">
</html>
3.將html文件發(fā)送到安裝了app的設(shè)備上,并使用瀏覽器打開(kāi)重荠,點(diǎn)擊頁(yè)面中按鈕出現(xiàn)以下“即將離開(kāi)瀏覽器前往第三方應(yīng)用或頁(yè)面”選項(xiàng)彈窗蚀浆,表示配置成功握牧!