How to Handle Deep Links with HTTPS Scheme to Open a Flutter App Instead of the Default Browser?

24 views Asked by At

I have a Flutter application that utilizes deep linking, and I want to handle deep links with the HTTPS scheme to open my Flutter app instead of the default browser.I've hosted the assetlinks.json file under my domain to support app links. Currently, when I try to open a deep link with the HTTPS scheme, it opens in the default browser instead of my app. How can I ensure that deep links with the HTTPS scheme are handled by my Flutter app?

Here's what I've done so far:

  • Added the necessary intent filter in the AndroidManifest.xml file to handle deep links with the HTTPS scheme.
  • Hosted the assetlinks.json file under my domain to establish the digital asset links.

However, this configuration doesn't seem to work as expected. I've tested it with the following shell command:

adb shell am start -a android.intent.action.VIEW "https://mydomain/"

The deep link still opens in the default browser instead of my Flutter app.

Here's my current approach in the AndroidManifest.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="https" android:host="mydomain" />
</intent-filter>

However, this configuration doesn't seem to work as expected. What am I missing? How can I modify my AndroidManifest.xml or any other necessary configurations to achieve the desired behavior of opening my Flutter app when a deep link with the HTTPS scheme is clicked?

Any insights or guidance would be greatly appreciated. Thank you!

0

There are 0 answers