'Firebase dynamic link doesn't invoke dynamic link on first launch after install

I have read a lot of question on stackoverflow but none of them answer the question.

I am trying to set up dynamic links so that a link will deep link the user to the app if they already have it installed and the play store if they don't. I expect the link to survive the play store installation process and be sent to the launcher activity with the link. The dynamic link works when the app is already installed. However, when the app is not installed, it sends the user to the play store but the dynamic link does not survive the installation process. I have read that the "Open" button is supposed to change to "Continue" when the user is sent to the play store with a dynamic link, but when I do it, it still says "Open". Here is my activity in AndroidManifest.xml for the activity

    <activity
        android:name="com.xxx.xxx.xxx.xxx"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.SplashScreen">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </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="yyy.page.link"
                android:scheme="http" />
            <data
                android:host="yyy.page.link"
                android:scheme="https" />
        </intent-filter>
    </activity>

The Activity is as follows:

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_ia_login);

        checkIfReferral();
    }

    private void checkIfReferral(){
    FirebaseDynamicLinks.getInstance()
            .getDynamicLink(getIntent())
            .addOnSuccessListener(this, new OnSuccessListener<PendingDynamicLinkData>() {
                @Override
                public void onSuccess(PendingDynamicLinkData pendingDynamicLinkData) {
                    // Get deep link from result (may be null if no link is found)
                    Uri deepLink = null;
                    Log.w(TAG, "FBDL we have a dynamic link");
                    if (pendingDynamicLinkData != null) {
                        deepLink = pendingDynamicLinkData.getLink();
                    }else{
                        Log.w(TAG, "FBDL pending dynamic Link Data is null , returning " );
                        return;
                    }
                    FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
                    Boolean ret1 = (user==null);
                    Boolean ret2 = (deepLink !=null);
                    Boolean ret3 = (deepLink.getBooleanQueryParameter("invitedby", false));
                    referrerUid = deepLink.getQueryParameter("invitedby");                   
                    if (deepLink != null && deepLink.getBooleanQueryParameter("invitedby", false)) {
                        referrerUid = deepLink.getQueryParameter("invitedby");
                        createAnonymousAccountWithReferrerInfo(referrerUid);
                    }
                }
            }).addOnFailureListener(this, new OnFailureListener() {
        @Override
        public void onFailure(@NonNull Exception e) {
            Log.w(TAG, "FBDL we couldnt receive dynamic link");
        }
    });

    FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
    if(user !=null) {
        Log.w(TAG, "FBDL if use != null");
        userRecord = FirebaseDatabase.getInstance().getReference()
                .child("users")
                .child(user.getUid());
    }
}

I have added the dynamic link. It is the same as declared in the manifest file. I have added SHA 256 generated from the release key that i signed the app with. The app is on Google Play Store production release.

Please let me know what the mistake is.

Why don't I see "continue" on the Google Play store when dynamic link took me there?



Solution 1:[1]

You have to add an auto-verified intent filter to the Activity that will handle the Dynamic Link, setting the host to your project's Dynamic Links domain as found in the Firebase console. In the AndroidManifest.xml:

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

Note that the android:host must be set to your Dynamic Links domain, and not the domain of your deep link.

More informations here

Solution 2:[2]

I see that App Links is enabled in your implementation of Firebase Dynamic Links. App Links require the Dynamic Link domain to be added in the Manifest intent-filter, but Dynamic Links still needs to have intent-filter for the deep links that the app will receive. By adding deep links in the intent-filter, not only that it makes FDL to work with the app, but it also ensures that the app will still work if a regular link is used.

If you're still having issues after this, you can file a ticket here https://firebase.google.com/support. You may need to share the Dynamic Link and the Firebase SDK version you're using.

Solution 3:[3]

i think you need to enable link handling verification for your app. here is more details

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

Solution 4:[4]

A Dynamic Link is a deep link into your app that works whether or not your app is installed. On desktop it will go to the deep link URL

Please check your mobile browser mode. Is desktop mode enabled? if yes, then on link click, it will redirect on URL only not to google play store.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ismail alaoui
Solution 2 Omatt
Solution 3 Ramy Ibrahim
Solution 4 Kamal Bunkar