branch metrics link on Android app

787 views Asked by At

I'm using Branch lib an Android to generate links that I send afterwards via sms. If user has no app installed on the phone, your link correctly transfers to Play Store ( the link in the dashboard ). After installing and running the application it receives all data from the link as expected.

However, if I have the app already installed on the phone, pressing the link does not open the app but redirects me again to Play Store. If I press the "Open" button there, the app receives the information but how about running the application directly from browser? I saw our iOS implementation of the same lib and it works flawlessly - i.e. when I have the app and I press the link it opens the app without sending me to store.

Perhaps I did something wrong in my declaration in the manifest?

Thanks in advance,

Kalin

1

There are 1 answers

2
Sahil Verma On BEST ANSWER

Chrome requires an intent string that matches what's defined inside your Android Manifest to properly open an application found on your device. If something's off, Chrome wont open the app. If you're using Branch for deeplinks, you need to make sure the following match:

TL;DR, make sure these match on Branch dashboard and Manifest

  • package name on branch dashboard is the same as your app build's
  • host="open" on Activity, because Branch formats intent strings as scheme://open
  • URI scheme registered on Branch is the same that's found in your AndroidManifest.xml
  • The same Activity has the following property: android.intent.category.BROWSABLE

The longer explanation is that Branch takes the link tied to your account, and constructs an Intent string that looks like the following:

intent:
HOST/URI-path // Optional host 
#Intent; 
  package=[string]; 
  action=[string]; 
  category=[string]; 
  component=[string]; 
  scheme=[string]; 

end;

When Branch does the redirect, we pull the scheme and package from your account, and assume you have set android:host as open:

intent://open#Intent;scheme=scheme;package=package;end"

And place that inside window.location. If the registered scheme on your dashboard or package don't match, or open isn't specified in the android:host key, then you'll be taken to Chrome.

It's also important to specify the following android.intent.category.BROWSABLE as a category filter. More information on intent strings here.