React-native-firebase: Dynamic links fail to open on custom browsers as Facebook

Created on 15 Oct 2019  路  33Comments  路  Source: invertase/react-native-firebase


Issue



Describe your issue here
i generated a short link and copied the url to facebook or just share the link through Facebook.
when try to open the link on Facebook - in Facebook browser - fail to redirect
if i choose to open via Crome browser - opens as expected

example link:
https://farmerdirecto.page.link/EZmK
WhatsApp Image 2019-10-15 at 12 38 32
WhatsApp Image 2019-10-15 at 12 39 03


Project Files






iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like:

# N/A
#### `AppDelegate.m`:
// N/A


Android

Click To Expand

#### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [ ] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`:

// N/A
#### `android/app/build.gradle`:
// N/A
#### `android/settings.gradle`:
// N/A
#### `MainApplication.java`:
// N/A
#### `AndroidManifest.xml`:
<!-- N/A -->


Environment

Click To Expand

**`react-native info` output:**

 OUTPUT GOES HERE
- **Platform that you're experiencing the issue on**: - [ ] iOS - [ ] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `e.g. 5.4.3` - **`Firebase` module(s) you're using that has the issue:** - `e.g. Instance ID` - **Are you using `TypeScript`?** - `Y/N`




Think react-native-firebase is great? Please consider supporting all of the project maintainers and contributors by donating via our Open Collective where all contributors can submit expenses. [Learn More]

Firebase SDK Firebase Support Android Links Stale

All 33 comments

Thanks for the report. I'm not 100% sure whether this is our issue or Firebase's. We don't do anything special in regards to where the link is detected from, so it could be a Firebase issue.

If the setup is correct, when the app is not published yet are dynamic links meant to open the app or take the user to the app store link? I am struggling to get dynamic links to open the app in iOS. I am unsure if this is a bug or not... Branch links are opening as intended.

Opening link with Viber, Skype doesn't work also.
Guess it's WebView issue.
We can't do anything with it?
It no make sense to use Firebase Dynamic Links with such issue :(

Having the same issue and I contacted firebase support

Firebase response

Hi Fakhruddin,

I'm Lecil. Thanks for contacting us.

The issue in Firebase Dynamic Links with Facebook has been resolved. We will conduct an internal investigation of this issue and make appropriate improvements to our systems to prevent or minimize future recurrence.

Let me know if you're still having issues related to this.

Regards,
Lecil

Me

I just wanted to let you know, the issue still exists in Facebook android.
In iOS, it works perfectly.

But in the newest version of Facebook android, click on the dynamic link doesn鈥檛 open an app if the app is installed, and it will redirect to the store page.
But if the app is not installed, it will correctly redirect to the store page.

Firebase response

Hi Fakhruddin,

Thanks for the update.

To have a better insight on what can be going wrong here, could you send the following information:
Long (and short link) demonstrating issue
Device: [ie: Nexus 5]
Browser/version: [ie: Firefox v20]
Platform/Version: [ie: AndroidM]
Android package name affected: [ie: com.foobar.android]
Expected Result: [ie: FDL opens app and deep-linked]
Complete reproducibility steps: [ie: Click in iMessage]
Actual result (including screenshots, specific error messages or stack traces as applicable)
Any extra information you could share would be very helpful.

I provided the requested information

and their response finally

Hi Fakhruddin,

Thanks for bringing this up. I can replicate the issue.

I've forwarded this bug report to our engineering team. I'll keep you posted for any updates.

Regards,
Lecil

I tested Firebase dynamic link with native firebase integration ( not using this package ) and it works fine for all platforms.

I thinks its definitely an issue with react-native-firebase package

i think it is a firebase server side issue:

  1. nothing has changed in my links or my client link handler
  2. if i open link on chrome browser it behaves as expected
  3. if i change Facebook settings see below - it behaves as expected
  4. open link from sms, whatsapp - is ok
  5. i opened an issue as well on Firebase support - and eventually got response

opened an issue in https://github.com/firebase/firebase-android-sdk/issues/915

when you change in Facebook setting and privacy -> setting-> media and contacts -> open links externally -> on - to open external links it works fine.
but by default this is disabled - and prevents users to open a firebase link

i think FB made some changes on there browser - my app now opens but firebase.links().getInitialLink() returns null
or

firebase.links().onLink((url) => {
            console.log("firebase onLink ::: link = "+JSON.stringify(url));
            this.handleDeepLinkUrl(url)
                }); 

is not invoked
when i open by external link browser or by device default browser all is fine
something is broken with firebase link and FB browser

update:
it might be this package (FB - RN) issue after all -
if i use React Native Linking it receives the url correctly

componentDidMount() {
  Linking.getInitialURL().then((url) => {
    if (url) {
      console.log('Initial url is: ' + url);
    }
  }).catch(err => console.error('An error occurred', err));
}

and for returning from background:

componentDidMount() {
  Linking.addEventListener('url', this._handleOpenURL);
}
componentWillUnmount() {
  Linking.removeEventListener('url', this._handleOpenURL);
}
_handleOpenURL(event) {
  console.log(event.url);
}

but i do not know what has changed!?

i combined the two url listeners (Firebase, Linking) and it works perfectly.

This is great digging, thank you guys.
The original issue was logged against react-native-firebase 5.4.x - but with multiple people involved, and maybe multiple versions can anyone verify how it's working on react-native-firebase 5.5.6 or 6.0.3 (i.e., current of the two branches)? And which version of react-native you were using @DanGDroid plus the affected platform(s) (android / ios) so we can compare how the linking resolution works between RNFB and RN Linking

i use: "react-native-firebase": "^4.2.0"
& on Android : implementation ("com.google.firebase:firebase-core:15.0.2")

this issue is on Android only on Facebook browser only.

  • if open link externally(from Facebook browser) - no issue

Hmm - so the question is if this is reproducible on either RNFB556/RNFB603 and the current android firebase bill of materials (24.0.0 I think - it was last week anyway).
The workaround is fantastic (thanks for posting it) but it would be great if it all just worked of course...

The new firebase support response about the issue

Hi Fakhruddin,

I hope this email finds you well. We've rolled out a fix for this issue. Now, Firebase Dynamic Link (FDL) for Android uses market URL instead of intent redirect. The different between the two is that intent redirect does not require any app change for FDL to work, while market URL's deeplinking requires app's URL intent filter.

To implement the fix, the Android app's AndroidManifest.xml needs to be updated by adding intent filter to support your deep link. 

The Google Play Client (version 3.5.12 or later) supports URL of the form market://details?id=<id>&url=<deep-link>&min_version=<min_version>
id: (required) the package name of the app to launch (e.g. com.android.vending).
url: (required) the URL to pass in the intent (e.g. mycompany://show_product?id=12345).
min_version: (optional) minimum android:versionCode of the application that supports handling the deep-link. If the version of the installed app is less than this, the user will be taken to the details page and asked to update (and then presented with a "Continue" button).
This is how it works on the phone:
After the AdClick, if the app is not installed, the Play Store app opens up to show the details page of the app identified by the id param.
Click Install.
Click Accept and Download.
After install finishes, a user can "Continue" (instead of the usual "Open").
The market throws an intent with the deep-link. Your app launches with the deep-link (i.e. the url param).

How strange. So, one indication is that react-native can handle it already by the built in Linking API. And another is that using the firebase android sdk directly works. Yet they seem to think it is still an issue on their end and they rolled out a fix? To what component (and what version)?

I'm a little bit confused, But it seems reasonable

Because the Firebase dynamic link has two sides. One is the firebase server which creates the link and another side is the SDK which serve the link

We may don't need to change the SDK or react-native-firebase implementation
They changed the mechanism to build the link, and it fixed the issue
I didn't try their solution yet.

as @FakhruddinAbdi said it seems as a Firebase server issue:
i would like to describe again the issue for clarification:
up until last few months that we started receiving bug reports we had a Firebase Dynamic link implemented in our app - create a short link by Firebase server and share the link on various platforms as Facebook Whatsapp etc. - all worked as expected = redirect to Firebase server handle the url and receive back on client the link to our app and open and deep navigate as expected.
recently Facebook released a version that handles our link inside the Facebook apps browser - failing the redirection of the url - see blank screen shot above,
after i opened an issue report on Firebase(or without connection to my report) there was a change in link behaviour = FaceBook browser redirected to my app(or store if not installed) but the deep link in my app failed because no url was received on client firebase listeners - only with this fix with RN Linking it received the url
** there was never a problem with redirect or deeplink from other platforms by opening link or ether by opening on Facebook after enabling the option on Setting to open external links - the url was received as expected - the only problem is by redirecting the url by Facebook custom browser - the strange thing is by the two options of receiving the url in my app - the url seems identical

that is all quite odd but also informative - thanks a bunch for the details. Seems like this could be closed by only with a doc update that mentioned the new style?

I tried to use google support solution, but couldn't figure out how to do it

I don't know where to use the market URL they mentioned in the mail.

Anyone here can help

Not sure what the next steps here are? Seems like theres conflicting reports of it being a React Native Firebase issue vs a Firebase SDK issue.

Guys, my Facebook app on Google Pixel 2 today is launching dynamic links fine with parameters in Android. However iOS is still broken and displaying a white screen. I do believe this is/was a larger issue with firebase dynamic links (https://github.com/firebase/firebase-android-sdk/issues/916) globally as where they land to click our dynamic link isn't even using React but rather angular.js..

Is this still a problem for you guys on Android?

i combined the two url listeners (Firebase, Linking) and it works perfectly.

How did you combine the two approach @DanGDroid ?

The upstream firebase issue has moved for people that want to track it. https://github.com/firebase/firebase-android-sdk/issues/916 - thanks @DanGDroid for describing how to use a combo of built in react-native Link + Firebase Dynamic Links to work around it so the app always gets the link

Hello 馃憢, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.

I really don't understand what solution @DanGDroid has been described. It's not clear and not a standard solution, it is just a workaround until someone proposes or commits the final fix.

Please help to fix it, we have invested a lot on facebook advertisement using the dynamic link for our business

Hello 馃憢, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.

Hi @DanGDroid , @mikehardy can you please help with the solution. I am using Google Gmail to open up my firbase dynamic link but I am getting null on listening the link. Is there any way to solve this or get this done ?

Hello 馃憢, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.

I did some investigation and this is what I found out so far.

TLDR Firebase Dynamic Link SDK might be having an issue. Facebook In-App Mobile Browser for Android is definitely having issue in redirecting in my experience.

Scenario 1. Long link - Android working, iOS partially broken.

I create a dynamic link manually. So, it is a long link such as "https://myanlearn.page.link/?link=https://www.myanlearn.com/course/607138951&apn=com.myanlearn_for_students&isi=1441239224&ibi=com.myanlearn.myanlearnforstudents". Posted the link on my Facebook Feed. When I open it in Android, my app is opened immediately and deep link is working as intended. When I open in iOS, the app is opened but deep link is not working. Surprisingly, no preview page is loaded in both iOS & Android.

Scenario 2. Short link - Android (FB Mobile Browser) not working, iOS working.

Then i create a dynamic link through REST API and got a link such as "https://myanlearn.page.link/vVp9eoQHnMSBLWxA6". Posted the link on my Facebook Feed. When I opened it in Android, Facebook's Mobile Browser tried to open my link and it opens "Play Store" page (if no fall back link androidFallbackLink is provided) OR opens fall back web link (if androidFallbackLink is provided). When I open in iOS, the preview page is loaded. Then my app is opened and deep link is working as intended. I tested the short link in all the other apps in Android and they are all working fine. So, I guess the way FB Mobile Browser is handling the link is broken somehow OR Firebase's detecting + directing is broken somehow in FB Mobile Browser.

Tested iOS: iPhone 6, iPhone 11
Android: OnePlus 2 (Android 6.0), Mi F1 Pocco (Android 9.0)

Hope this helps to find the issue and hopefully the fix...

After more investigation, I found out that the issue is in Firebase SDK to generate dynamic link short links. If there are socialMetaTagInfo data, the link is going to be broken and Facebook Mobile Browser will open web page. However, if there is no data for socialMetaTagInfo section, the link will work as intended.

However, make sure your SHA256 fingerprints are in Firebase Console. You can get both your dev fingerprint and Google Play Store's key in Play Store > Release Management > App Signing and put them in Firebase > Project Setting > Android Apps > SHA Fingerprints.

Hope this helps!

Hello 馃憢, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.

Closing this issue after a prolonged period of inactivity. If this is still present in the latest release, please feel free to create a new issue with up-to-date information.

same me

please fix it

@danghung24031992 do not come to an open source project and say "please fix it", as an etiquette issue.

It's open source, you propose a PR to fix it.

Was this page helpful?
0 / 5 - 0 ratings