Firebase Dynamic link always null

Viewed 421

I am having really hard time configuring correctly Firebase Dynamic Links in Android. (The same dynamic links works fine in iOS)

I created a dynamic link from Firebase console. The generated link is something like this:

https://myexample.page.link/XzPY

This is the configuration in Firebase:

enter image description here

In the manifest I added this intent filter:

<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="myexample.page.link"
          android:scheme="https" />
</intent-filter>

Also the behaviour for Android have been set to "Open the deep link in your Android App".

This is the part that is supposed to handle the dynamic link in my Activity:

Firebase.dynamicLinks
                .getDynamicLink(intent)
                .addOnSuccessListener(this) { pendingDynamicLinkData -> // ALWAYS NULL!
                    var deepLink: Uri? = null
                    if (pendingDynamicLinkData != null) {
                        deepLink = pendingDynamicLinkData.link
                    }
                }

If I try to open the link from the browser (from my laptop) I see that it is redirected to the right page. If I try to open the same link from Android I see two wrong things:

  1. The link doesn't redirect me to the app, but shows me the option to select the App or the Browser.
  2. If I select the app the pending dynamic link data is always null.
1 Answers

Try with add this

    <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="YOUR_HOST_LINK"
                android:scheme="http" />
            <data
                android:host="YOUR_HOST_LINK"
                android:scheme="https" />
     </intent-filter>




 FirebaseDynamicLinks.getInstance().getDynamicLink(intent)
        .addOnSuccessListener { pendingDynamicLinkData ->
            if (pendingDynamicLinkData != null) {

            }
Related