4
votes

I am trying to add Branch.io Deep Linking to my application. Link which I generate inside the application redirects to the website instead of launching app. I noticed that when I manually open app after that it navigates to the Activity which I want to be opened via Deep Link. I added Branch.io via Fabric kit and followed step by step tutorial in Fabric about Deep Linking Routing. My app is not in Google Play Store yet.

Thats my configuration on website (I also checked option: Always try to open app and Test mode on the top of the dashboard). Links which I am generating should be test too, because I see test key in BranchSDK: response/request

http://imgur.com/a/mgLgu

AndroidManifest.xml

    <application
    android:name=".app.MainApplication"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">

    <meta-data
        android:name="io.branch.sdk.TestMode"
        android:value="true" />
    <meta-data
        android:name="io.branch.sdk.BranchKey"
        android:value="key_live_xxx" />
    <meta-data
        android:name="io.branch.sdk.BranchKey.test"
        android:value="key_test_xxx" />

    <activity
        android:name=".ui.main.MainActivity"
        android:label="@string/app_name"
        android:launchMode="singleTask"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

        <intent-filter>
            <data
                android:host="open"
                android:scheme="example" />
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
        </intent-filter>

Build.gradle

//...
applicationId "com.example"
//...
 compile('io.branch.sdk.android:library:2.4.3@aar') {
    transitive = true;
}

MainApplication

@Override
public void onCreate(){
    super.onCreate();
    Fabric.with(this);
    Branch.getAutoInstance(this);
}

I can add more code snippet if needed.

2

2 Answers

5
votes

Alex from Branch.io here:

Because the app navigates to the correct activity when you manually launch it after clicking a link, this means that most of your configuration is correct. The only piece that appears to be missing is the code that triggers your app to actually launch.

On Android, Branch uses your URI scheme for this. That is this section of code:

<intent-filter>
    <data
        android:host="open"
        android:scheme="example" />
    <action android:name="android.intent.action.VIEW" />

    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
</intent-filter>

You need to replace the example value in the android:scheme="example" piece of this with some other, custom string. Then make sure you have that same string (plus ://) in the Link Settings section of the Branch dashboard.

That should be enough to get you up and running here. You may also want to check out our full developer documentation. The Fabric guides are a great way to get started, but they only cover a small fraction of the functionality available through Branch!

0
votes

If the accepted solution does not work for you then try checking the Always try to open app option at the top of https://dashboard.branch.io/link-settings.