Firebase dynamic links do not run my application in a specific situation

I made a dynamic link so that users can share some content in my application.

The link works when I click the link on an HTML page using the href tag on an Android device.

This means that if the application is not installed, go to the Play Store, and then open the application, and I can get the deep link address.

But when the link is exactly the same in other places, like facebook messenger or email, etc., I click the link and then it doesn’t work.

It is always redirected to the Play Store, even if my application is already installed.

What is the problem?

My code is here.

  • .java for deep link

     GoogleApiClient mGoogleApiClient = new GoogleApiClient.Builder(this) .enableAutoManage(this, this) .addApi(AppInvite.API) .build(); boolean autoLaunchDeepLink = false; AppInvite.AppInviteApi.getInvitation(mGoogleApiClient, this, autoLaunchDeepLink) .setResultCallback( new ResultCallback<AppInviteInvitationResult>() { @Override public void onResult(@NonNull AppInviteInvitationResult result) { if (result.getStatus().isSuccess()) { // Extract deep link from Intent Intent intent = result.getInvitationIntent(); String deepLink = AppInviteReferral.getDeepLink(intent); Log.e("sf", "### deep link : " + deepLink ); } else { Log.d("asdf", "getInvitation: no deep link found."); } } }); 
  • The target portion of the activity in AndroidManifest.xml

      <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="mycode.app.goo.gl/" android:scheme="https" android:pathPattern=".*" /> </intent-filter> 
  • dynamic link

    https://mycode.app.goo.gl/?link= web page address & al = my custom scheme for sharing & apn = my android app package name

+5
source share
2 answers

We have implemented Firebase Dynamic Links in accordance with this documentation https://firebase.google.com/docs/dynamic-links/ , and they work correctly in all cases except the Facebook and Facebook Messenger application.

First, we create a dynamic link to our application:

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

Then we create a 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 a long dynamic link with a short link to https://firebasedynamiclinks.googleapis.com/v1/shortLinks and share it using the 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 the Facebook application:

  • The short link is correctly divided.
  • If the application is not installed, clicking on the link in the Facebook application goes correctly on Google Play and after installing the application, the deep link is processed correctly.
  • If the application is installed, clicking on the link in the Facebook application also applies to Google Play, and after clicking the "Open" button, the deep link does not transfer to the application, because Google Play does not transfer referrer information to the application if the installation was not completed.

If we share this link using the Facebook Messenger app:

So, I see three problems:

  • The Facebook application does not correctly detect that the application is installed.
  • The Facebook Messenger app uses a long dynamic link instead of a short one.
  • The Facebook Messenger application may detect that the application is installed, but goes to the link instead of Google Play if the application is not installed.

Does anyone have an idea of ​​what is happening with how to solve these problems?

PS: Although it doesn’t matter because deep link processing in the application works correctly, this is our intent filter shown:

  <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> 
+3
source
 //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" 
0
source

Source: https://habr.com/ru/post/1261485/


All Articles