33

Problem — when opening a Firebase Dynamic Link on Facebook Mobile, the Facebook Browser consumes the deep link and does not open the intended mobile app

Question — is there a good workaround in Firebase to help Facebook deliver on the promise of presenting my Dynamic Link as intended?

We are aware of http://applinks.org, and that Facebook is a contributor. Does Firebase have a way to configure their server using the AppLinks spec so that Facebook will pass through the Deep Link to our app instead of consuming it?

Background — I have created a Firebase Dynamic Link for an iOS and Android app.

The Dynamic link delivers everything I expect and is a fantastic experience.

  1. When opened on iOS, it navigates to the App. If not installed, it goes App Store
  2. When opened on Android, it navigates to the App. If not installed, goes to Play Store
  3. When opened on non-mobile, it navigates to our Website
  4. On Facebook mobile, neither 1 nor 2 happens. The result is that it goes straight to the mobile web experience, thereby eliminating the promise of the Firebase Dynamic Link
RobLabs
  • 2,257
  • 2
  • 18
  • 20
  • try enabling "Link open externally" option under facebook app. App Settings -> Links open externally. This option is disabled by default and causes the links to be handled internally by facebook app. After enabling this option, app links work as expected. I don't why FB tries to be oversmart! – Rahul Shukla Jan 07 '17 at 11:10
  • 1
    @trivalent nice, but how can I force users to set this setting? This is solution but cannot be used on large scale – VizGhar Jan 11 '17 at 09:41
  • 1
    @VizGhar see my answer how we solved the problem. – Rahul Shukla Jan 11 '17 at 13:33
  • I have written a detailed solution document under this question: https://stackoverflow.com/questions/46266797/deeplink-solution-for-ios-and-android-apps-works-in-facebook – Mustafa Atalar Sep 17 '17 at 18:21

7 Answers7

8

To avoid this cases we made a webpage which redirects to firebase dynamic link. With this solution we can:

  1. Use our domain, not the firebase url.
  2. Ensure that firebase links works in every cases, for example when it opens from a custom browser (fb, samsung).

The disadvantage of doing this is that you'll always need to pass through a web page with an redirect.

German
  • 784
  • 5
  • 4
  • Is the Firebase URL the reason you need this work around? – RobLabs Jun 15 '16 at 20:39
  • Yes, we can manage to do that, but then we lost analytics data e.g click, first_open attribution source. Do you have ideas for that troubles? – Ricky Aug 23 '16 at 11:34
  • I done changes as you suggested. But facebook browser not redirecting the url. – Nidhin Oct 01 '19 at 04:33
4

We were struggling with the similar issue and here's how we finally solved it:

Say this is the final firebase url you are going to share

https://xxxx.app.goo.gl/?apn=com.your.package&link=http://www.yourwebsite.com

Now in the index.html page of your website, add the following meta tags

<meta property="fb:app_id" content="your_fb_app_id" />
<meta property="al:android:package" content="com.your.package" />
<meta property="al:android:app_name" content="YourAwesomeApp" />
<meta property="al:android:url" content="somescheme://XYZ" />   <!-- identifiable by your app, your app must handle this data scheme inside your manifest's intent-filter tag --!>
<meta property="al:web:should_fallback" content="true" />
<meta property="al:web:url" content="http://www.yourwebsite.com/" />

Now the app launches on clicking on the facebook post shared using this link.

Rahul Shukla
  • 1,292
  • 9
  • 25
  • 1
    Explaining the reasons for downvote would really help! – Rahul Shukla Nov 22 '18 at 10:47
  • can you give an example of somescheme://XYZ and manifest.xml to handle the scheme ? Does this really work? Nobody gives good comment for this aswer. – Plugie Dec 12 '19 at 00:30
  • I can try to develop a demo as and when I find a time, but really can't commit. However, you can try and see if it works or not! – Rahul Shukla Dec 12 '19 at 04:16
  • this is not clear, can you explain how I do this as the Facebook redirect me to the play store after opening the in-app browser no to our website anyway – hesham shawky May 11 '20 at 21:34
  • Either I don't do it the right way or it just doesn't work. I first created an Html page, then filled it with your HTML-META and finally changed the value with my custom ones, but Facebook no just open a blank page and stay there! – Toukea Tatsi Dec 02 '22 at 14:07
4

I recently had to integrate dynamic links to one of my clients apps, and I got lots of trouble because of deeplinks not working on facebook+android_app.

As I couldn't move to branch.io because of princing reasons, I had to work it out on a different way so followed @Rahul Shukla advise.

I ended with a very simple nodejs+express setup where I receive the dynamic link ID and return a HTML with all the meta-tags required by facebook applinks (android + iOS) and a redirect script (window.location = 'your_dynamic_link') for other clients to be used.

The best part is that now on facebook the app opens directly without the preview page in both platforms and the link works on all browsers via the script redirect.

Here is the gist

Dulaj Kulathunga
  • 1,248
  • 2
  • 9
  • 19
rsevil
  • 41
  • 5
4

the solution I found was to redirect to the dynamic link from a webpage like this

window.location.href = "intent:https://example.page.link/2wertygf456#Intent;end";

this will open the link in your system default external browser and the deeplinks works perfectly.
to trigger this only on facebook in-app browser

if (ua.indexOf("FBAN") != -1 || ua.indexOf("FBAV") != -1) {window.location.href = "intent:https://example.page.link/2wertygf456#Intent;end";}
Faris Mohamed
  • 73
  • 1
  • 5
  • This works on Android phones only it seems. We can't get this to work on iOS phones. – spierce7 Feb 06 '21 at 15:36
  • a simple shortlink should work for ios, however make sure to include your 'iosAppStoreId' under 'iosInfo' when you create the dynamic link. – Luis Jun 13 '21 at 20:58
  • The redirection works, but, unfortunately, it is done inside the Facebook browser. Which make the dynamic link to still don't work in my case! – Toukea Tatsi Dec 02 '22 at 14:10
1

I've tried some ways but totally fail. When I use the dynamic link in Facebook post, it shows a dialog to ask me if I wanna open application (I did not install my application yet). Although I accept to open app, nothing happens, it does not open Apple Store as expected

I have to use link like below to force it open apple store app https://myapp.app.goo.gl/?link=http://mylink.com&ifl=https://itunes.apple.com/us/app/apple-store/idxxxxxxxx%3Fmt%3D8%26ct%3Dutm_source

Ricky
  • 569
  • 4
  • 16
0

Deep link with facebook app not work in android because facebook uses InAppBrowser, If you want to make your deep link url workable in facebook. You can change facebook settings like: In Facebook App: Goto Profile -> App Setting -> check Links open externally.

After changing the setting you will be open deeplinks from facebook app android

Shivang
  • 935
  • 8
  • 18
0

Try to enable "Link open externally" option from facebook app:

Settings-> Preferences-> Media-> Links open externally.

BAANG!

Tanvir Ahmed
  • 564
  • 6
  • 13