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

Mina Farid
  • 2,327
  • 4
  • 22
  • 34
  • Possible duplicate of [Firebase dynamic links is not launching my app in specific situation](https://stackoverflow.com/questions/41217810/firebase-dynamic-links-is-not-launching-my-app-in-specific-situation) – Nouman Ch Sep 26 '17 at 12:29
  • 2
    No its not duplicated. – Mina Farid Sep 26 '17 at 12:36
  • 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! https://firebase.google.com/support/contact/troubleshooting/ – Ian Barber Sep 29 '17 at 23:21
  • @MinaFared found a solution for this ? – Mr.G Apr 04 '18 at 11:52
  • @Mr.G sorry i didn't find yet. its a bug from messenger itself – Mina Farid Apr 04 '18 at 12:04
  • did u try to constructor the URL manually ? and this works if i share a link through iOS – Mr.G Apr 04 '18 at 12:28
  • 2
    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. – Khalid Taha May 24 '18 at 08:47

0 Answers0