Reputation: 7519
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
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
Code:
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://o5kn2.app.link/63yW7yM7C5"));
startActivity(browserIntent);
Upvotes: 2
Views: 1481
Reputation: 29
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.
Upvotes: 1
Reputation: 1128
Make sure to make update an Activity to handle deeplinks, in AndroidManifest you have added IntentFilter with Viewable action.
<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>
Upvotes: 0