Integrate Blueshift's deep links

This article provides steps on how to use Blueshift's deep links (commonly known as Android app links) to launch pages in your app.

📘

Wait. Are you ready for this part?

In this article, we'll show you how to integrate Blueshift's deep links in your app. However, this cannot work until you have the SDK in your project and you can use it in your app. If not, then we suggest that you do those things first and then come back here.

It's absolutely not complicated. And, if you've come this far, you know that this works. :relaxed:

You can use Blueshift's deep links in the campaigns that you run with us. Blueshift's deep links are usual http/https URLs that take users to a page in the app if they click on one of them or launch them in a browser. If an email or text message that we send as a part of your campaign contains a Blueshift deep link and a user clicks on it, Android can launch the app and take the user to the page that is mapped to it.

Prerequisites

Before you get started, there are a couple of things that we need you to do:

  • The Blueshift deep link domain should have a cname record that points to links.getblueshift.com. (This is probably done if you have configured email campaigns with us. A valid cname record looks like links.clientdomain.com that points to links.getblueshift.com. Only top-level domains and subdomains are supported at the moment. For example, either clientdomain.com or links.clientdomain.com should point to links.getblueshift.com. We do not support path on a domain such as links.clientdomain.com/repo/folder.)
  • Share the applinks.json file with us. Perform the following steps to submit the applinks.json file on our platform.
    1. Sign in to the Blueshift web app.
    2. On the Account Settings page, select the Other Settings tab.
      alt textalt text
    3. Provide the following details on this page:

Field

Description

AASA File

Copy-paste the contents of the Apple-App-Site-Association (AASA) file if you have an iOS app and you want to use the Blueshift deep links functionality of our SDK.

For more information on our iOS SDK, see About Blueshift's iOS SDK.

Asset Links File

Copy-paste the contents of the applinks.json file to use the Blueshift deep links functionality of our SDK.

For more information, see Declare website associations on Android developer portal.

  • The host app should be configured to receive and handle the redirection URL obtained from the universal links received in emails or SMSes (described below).

Integration

There are two ways you can override how our SDK processes the Blueshift deep links.

1. Override BlueshiftLinksActivity

Register your activity in the AndroidManifest.xml file.

<activity android:name="com.example.MyLinksActivity">
   <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="links.clientdomain.com"
           android:scheme="http" />

       <data
           android:host="links.clientdomain.com"
           android:scheme="https" />
   </intent-filter>
</activity>

To handle the Blueshift deep link URLs, create an activity that extends BlueshiftLinksActivity. Then, override the getBlueshiftLinksListener() method to get a callback when a user clicks or launches the URL.

public class MyLinksActivity extends BlueshiftLinksActivity {

    @Override
    protected BlueshiftLinksListener getBlueshiftLinksListener() {
        return new BlueshiftLinksListener() {
            @Override
            public void onLinkProcessingStart() {

            }

            @Override
            public void onLinkProcessingComplete(Uri uri) {

            }

            @Override
            public void onLinkProcessingError(Exception e, Uri link) {

            }
        };
    }
}

2. Use handleBlueshiftUniversalLinks method.

First, register your activity as the receiver of app links.

<activity android:name="com.example.MyLinksActivity">
   <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="links.clientdomain.com"
           android:scheme="http" />

       <data
           android:host="links.clientdomain.com"
           android:scheme="https" />
   </intent-filter>
</activity>

Call the SDK’s handleBlueshiftUniversalLinks() with a BlueshiftLinksListener to handle the app link callbacks.

public class MyLinksActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        new BlueshiftLinksHandler(this).handleBlueshiftUniversalLinks(
                getIntent(), new BlueshiftLinksListener() {

                    @Override
                    public void onLinkProcessingStart() {

                    }

                    @Override
                    public void onLinkProcessingComplete(Uri uri) {
                        // use this uri to take the user to the app’s page
                    }

                    @Override
                    public void onLinkProcessingError(Exception e, Uri link) {

                    }
                });
    }
}

❗️

Ensure that you replace links.clientdomain.com with the cname-record value that points to links.getblueshift.com.

For information on how to integrate Blueshift's deep links for iOS, see Integrate Blueshift's deep links.

Troubleshooting

Existing Android app links stopped working after we started using Blueshift's deep links.
This can happen if the assetlinks.json file is missing on both the domains. For more information, see this document.

Updated 28 days ago


Integrate Blueshift's deep links


This article provides steps on how to use Blueshift's deep links (commonly known as Android app links) to launch pages in your app.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.