我有一个需要从应用程序启动深层链接的要求。
这是我的深层链接。
https://n9zv0.app.link/63yWc1w1
现在,当我尝试从应用程序打开此链接时,它会崩溃并显示以下错误消息。
未找到用于处理Intent的活动:android.intent.action.VIEW
代码:
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://o5kn2.app.link/63yW7yM7C5"));
startActivity(browserIntent);
答案 0 :(得分:0)
请确保在AndroidManifest中更新了一个Activity以处理深层链接,并在其中添加了具有Viewable操作的IntentFilter。
<activity
android:name=".MyActivity">
<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="www.abc.com"
android:scheme="https" />
<data
android:host="www.abc.com"
android:scheme="http" />
</intent-filter>
</activity>
答案 1 :(得分:0)
设备中没有浏览器应用程序可打开链接。要解决此问题:
如果存在应用,请事先解决:
if (intent.resolveActivity(getPackageManager()) == null) {
// show no app available to user
} else {
// start activity
}
异常处理:
try{
// your intent here
} catch (ActivityNotFoundException e) {
// show message to user
}
或在Webview活动中打开以显示。