Flutter deep links not working from browser

100
April 24, 2022, at 03:10 AM

I made changes in Android manifes as suggested here: https://docs.flutter.dev/development/ui/navigation/deep-linking

So, new metadata and config has been added to MainActivity:

<!-- Deep linking -->
<meta-data android:name="flutter_deeplinking_enabled" android:value="true" />
<intent-filter android:autoVerify="true">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="http" android:host="flutterbooksample.com" />
    <data android:scheme="https" />
</intent-filter>

As a result, when I use adb for testing as they said to do:

adb shell am start -a android.intent.action.VIEW \
    -c android.intent.category.BROWSABLE \
    -d "http://flutterbooksample.com/book/1"

I am getting what I want:

But if I try to open url http://flutterbooksample.com/book/1 directly in browser on my emulator, nothing happens, browser opens page and theres no prompt to open url in my app.

Do I need to do anything else to make it working?

Answer 1
Short Answer

You can't call the deep link URL from the web browser's search bar. First, you need to create an HTML page. Then you can click the link. It will work.

More details

In my case, I created an HTML file with a deep link and send it to my email.

HTML file

<a href="myapp://test">Open my app</a>

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:host="test"
        android:scheme="myapp" />
</intent-filter>
Rent Charter Buses Company
READ ALSO
How to correctly return api response when using retrofit in android?

How to correctly return api response when using retrofit in android?

I am trying to make an app using mvvm design and in the repository class I am calling my api using retrofitI am getting correct response from my api and I want to return that response but while returning the data from my method the data value is null

95
How to open only camera and gallery using com.theartofdev.edmodo.cropper library?

How to open only camera and gallery using com.theartofdev.edmodo.cropper library?

I want set image validation like 72 ppi resolution and max size 100k so that I used comtheartofdev

123
Subprojects var type in dsl

Subprojects var type in dsl

I am transitioning my code to Kotlin DSL and as i have multimodule app i have some hack to transition gralde tasks like clean, build etc to other modulesSo i have following method in gradle:

63
Android Gradle Failed

Android Gradle Failed

I am trying to build a VPN application and when I try to build the application and run it on my phone, I keep getting these errors listed belowI tried upgrading the library dependencies, running it on offline mode,

174