[英]App crashes on opening deep link from the app
I have a requirement where i need to launch the deep link from the app.我有一个要求,我需要从应用程序启动深层链接。
This is my deep link.这是我的深层链接。
https://n9zv0.app.link/63yWc1w1 https://n9zv0.app.link/63yWc1w1
Now when i try to open this link from app, it crashes with following error message.现在,当我尝试从应用程序打开此链接时,它会崩溃并显示以下错误消息。
No Activity found to handle Intent: android.intent.action.VIEW
未找到处理 Intent 的活动:android.intent.action.VIEW
Code:代码:
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://o5kn2.app.link/63yW7yM7C5"));
startActivity(browserIntent);
Make sure to make update an Activity to handle deeplinks, in AndroidManifest you have added IntentFilter with Viewable action.确保更新 Activity 以处理深层链接,在 AndroidManifest 中,您已添加 IntentFilter 和 Viewable 操作。
<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>
There is no browser app in the device to open the link.设备中没有可以打开链接的浏览器应用程序。 To handle this issue:
要处理此问题:
Resolve beforehand if an app exists:如果存在应用程序,请提前解决:
if (intent.resolveActivity(getPackageManager()) == null) {
// show no app available to user
} else {
// start activity
}
Handle with exception:处理异常:
try{
// your intent here
} catch (ActivityNotFoundException e) {
// show message to user
}
or alternatively open in webview activity to display.或者在 webview 活动中打开以显示。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.