Android Firebase Dynamic links not working in Facebook messenger properly
Asked Answered
B

0

7

I integrated my application with dynamic links from firebase successfully. But when I share a short link with SocialMetaTagParameters and click on the link in messenger it opens the browser and it should redirected to my application, but it is entering in infinite loop in the browser.

I found similar issue created in google groups:

https://groups.google.com/forum/#!topic/firebase-talk/nOOcOwmxl58

This is my code to create short link:

Task<ShortDynamicLink> shortLinkTask = FirebaseDynamicLinks.getInstance().createDynamicLink()
    .setLink(Uri.parse(link))
    .setDynamicLinkDomain(mContext.getString(R.string.firebaseAppCode))
    // Set parameters
    .setAndroidParameters(new DynamicLink.AndroidParameters.Builder().build())
    .setIosParameters(new DynamicLink.IosParameters.Builder("com.xxxx.xxxx").build())
    .setSocialMetaTagParameters(
        new DynamicLink.SocialMetaTagParameters.Builder()
            .setTitle(title)
            .setDescription(description)
            .setImageUrl(Uri.parse(imageUrl))
            .build()
    )

    .buildShortDynamicLink()
    .addOnCompleteListener((Activity) mContext, new OnCompleteListener<ShortDynamicLink>() {
        @Override
        public void onComplete(@NonNull Task<ShortDynamicLink> task) {
            if (task.isSuccessful()) {
                // Short link created
                Uri shortLink = task.getResult().getShortLink();

                ShareApp(mContext, shortLink.toString());
            } else {
                Utils.ShowToast(mContext, "Sharing failed, Try again");
            }
        }
    });

This is my code to share the short dynamic link:

public static void ShareApp(Context mContext,String link) {
    Intent share = new Intent(Intent.ACTION_SEND);
    share.setType("text/plain");
    share.putExtra(Intent.EXTRA_TEXT,link);
    mContext.startActivity(Intent.createChooser(share, "Share..."));
}

This is code in manifest :

<activity
    android:name=".UI.Home.Consultants.ViewConsultantProfileActivity"
    android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
    android:label="Profile"
    android:screenOrientation="portrait"
    android:theme="@style/AppTheme"
    android:windowSoftInputMode="stateHidden">
    <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="consultrustconsultant"
            android:scheme="http"/>
        <data
            android:host="consultrustconsultant"
            android:scheme="https"/>
    </intent-filter>
</activity>

Note:

if I removed SocialMetaTagParameters, the link is working properly and when click on the link its redirected to my application

Bilbao answered 26/9, 2017 at 12:26 Comment(7)
Possible duplicate of Firebase dynamic links is not launching my app in specific situationPhrygia
No its not duplicated.Bilbao
I think the best bet here is to file a ticket with the support team and include the actual deep link that doesn't work - it'll be easier to debug. One other trick is to use the debugging (append &d=1 to the long link) to see if there are any warnings in there! firebase.google.com/support/contact/troubleshootingAlbarran
@MinaFared found a solution for this ?Lainelainey
@Lainelainey sorry i didn't find yet. its a bug from messenger itselfBilbao
did u try to constructor the URL manually ? and this works if i share a link through iOSLainelainey
the strange behavior is when you copy the link to messenger manually it will work, but it will not work if it's sent using share intent.Repeated

© 2022 - 2024 — McMap. All rights reserved.