What is in-app routing for mobile apps?

When you click a Branch deep link, and the users open or installs the app on their devices, they are taken directly to a specific content within the app. This process involves reading the Branch link inside the app and taking the user on a custom screen based on the data you receive.

 

This troubleshooting guide will help you solve the issues related to in-app routing in Android

 

Everything about the in-app routing of the Android App is configured via the following 3 components:

1. Configuring the Branch link on the Branch dashboard.

2.  Configuring Android app's Android-Manifest file to support the App Links and URI scheme

3.  Configuring Android apps’ Launcher Activity class to read the Branch deep link and then route the user to the specific screen in the app.


Step 1: Make sure you have followed our documentation to integrate Branch SDK

 

Step 2: Branch link verification 

Please make sure that the link you are testing with belongs to your app. This can easily be verified from the link domain that is present on your Dashboard-> Link settings->Link Domain. The Branch link domain resembles like "xxxx.app.link". If you are using the custom domain, please make sure it configured correctly as in the documentation here

 

Step 3: Configuring Branch link

This step is to configure the Branch link from the dashboard to add the relevant data which is required by the app. When you generate a Branch link, you need to add the custom deep link data which will be understood by your app.  For e.g you can add the following: 


key
value
nav_here

content/123

 

You can get more examples of what you use as custom data in the Branch deep links in our documentation here.

 

Step 4: Setting up in-app routing:

  1. Make sure the in-app routing is set up in the Launcher Activity class only. This is to ensure your deferred deep linking is working under every circumstance. This is a mandatory step.

  2. The code snippet has to be added in the onStart() method the Activity only. The onStart() method ensures the SDK has enough resources to initialize in the app after it is launched. This is also a mandatory step.

  3. Once you read the link data, you pass it to another Activity. 


You need to get the Branch deep link data parameters and consume them for redirection. The code snippet for reading the Branch link is:


Java
Branch.getInstance().initSession(new Branch.BranchReferralInitListener() {
    @Override
    public void onInitFinished(JSONObject referringParams, BranchError error) {
        if (error == null) {
            // navigate to page
            Intent intent = new Intent(MainActivity.this, OtherActivity.class);
            intent.putExtra("branchData", referringParams.toString(2));
            startActivity(intent);
        } else {
            Log.i("BRANCH SDK", error.getMessage());
        }
    }
}, this.getIntent().getData(), this);

 

Step 5: Advanced in-app routing(for advanced use-cases)

If you are using the $android_deeplink_path or $deeplink_path Branch link property, instead of using the custom key-value Branch link property, you would need to make sure you have set the URI scheme path in the Manifest file to handle those incoming link data. This is an automated process which requires a scheme to be set within the app. 


Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.