Firebase dynamic links is not launching my app in specific situation

≡放荡痞女 提交于 2019-12-03 07:55:27

We have implemented Firebase Dynamic Links according to this documentation https://firebase.google.com/docs/dynamic-links/ and they are working properly in all cases except of Facebook and Facebook Messenger app.

First we generate a dynamic link to our app:

Builder builder = new Builder()
  .scheme("https")
  .authority("winged-guild-133523.appspot.com")
  .appendPath("share")
  .appendQueryParameter("query", query);

Then we generate the long dynamic link:

Builder builder = new Builder()
  .scheme("https")
  .authority("zkkf4.app.goo.gl")
  .appendPath("")
  .appendQueryParameter("link", deepLink)
  .appendQueryParameter("apn", "com.mydomain.myapp");

Then we exchange the long dynamic link with a short link at https://firebasedynamiclinks.googleapis.com/v1/shortLinks and share it using intent:

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, text);
startActivity(Intent.createChooser(intent, null));

If we share this link using Facebook app:

  • The short link is properly shared.
  • If the app is not installed, clicking on the link in Facebook app goes properly to Google Play and after installing the app the deep link is handled correctly.
  • If the app is installed, clicking on the link in Facebook app goes also to the Google Play and after clicking on open button, the deep link is not transferred to the app because Google Play do not pass referrer information to the app if installation has not been performed.

If we share this link using Facebook Messenger app:

So I see three problems here:

  • Facebook app is not properly detecting that the app is installed.
  • Facebook Messenger app shares a long dynamic link instead of short one.
  • Facebook Messenger app can detect that the app is installed but goes to the link instead of Google Play if the app is not installed.

Do anyone have any idea what is going on an how to solve those issues?

PS: Although this is irrelevant because the deep link handling in the app is working properly this is our manifest intent filter:

  <intent-filter>
    <action android:name="android.intent.action.MAIN"/>
    <category android:name="android.intent.category.LAUNCHER"/>
  </intent-filter>

  <intent-filter android:label="@string/app_name">
    <action android:name="android.intent.action.VIEW"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <category android:name="android.intent.category.BROWSABLE"/>
    <data android:scheme="http"/>
    <data android:scheme="https"/>
    <data android:host="winged-guild-133523.appspot.com"/>
    <data android:host="www.winged-guild-133523.appspot.com"/>
    <data android:pathPattern="/share.*"/>
  </intent-filter>
//Remove this lines 
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE"/>

and  android:pathPattern=".*" /> //not required remove it also
and use android:scheme="http"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!