安卓deeplink怎么实现和调用
时间: 2024-01-14 13:02:59 浏览: 207
要在 Android App 中实现 Deeplink,你需要做以下两个步骤:
1. 在 AndroidManifest.xml 文件中注册 Deeplink 的 Intent Filter。
```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="your_scheme" android:host="your_host" />
</intent-filter>
```
将 `your_scheme` 替换为你的 Deeplink scheme,将 `your_host` 替换为你的 Deeplink host。
2. 在需要调用 Deeplink 的地方调用 Intent。
```java
Uri deeplinkUri = Uri.parse("your_scheme://your_host/path");
Intent intent = new Intent(Intent.ACTION_VIEW, deeplinkUri);
startActivity(intent);
```
将 `your_scheme` 替换为你的 Deeplink scheme,将 `your_host` 替换为你的 Deeplink host,将 `/path` 替换为 Deeplink 的路径。
这样,当用户点击 Deeplink 时,Android 系统会根据 Intent Filter 来寻找匹配的 Activity 并打开相应的页面。
注意:Deeplink 只会在安装了你的 App 的设备上打开 App,并且如果用户没有安装你的 App,点击 Deeplink 会跳转到应用商店进行下载。
阅读全文
相关推荐


















