Post-install Deeplinking Guide on

Post-install Deeplinking Guide

This guide will enable you to support Button's Mobile Web Publishers. In this guide, we'll:

  1. Configure Button Links
  2. Configure Universal Links
  3. Handle Post-install Deeplinks

Configure Button Links

In the Button Dashboard, navigate to "Merchant" > "Apps" & click on the App you want to configure a Button Links domain for. Once on the App details page, click on the "Add a Button Links Domain" button in the "Button Links Domains" section. Simply fill out the details in the popup modal to complete the configuration.

Configure Universal Links

To support App Links for the Button domain (to stop any browser redirecting) you need to add intent filters for the http and https scheme for the Button subdomain ( you registered. If you already registered an intent filter for your domain, you can simply add another to the same activity declaration.

We support verified web associated App Links so make sure to add the autoVerify="true" attribute to your intent filter. Note: this support is part of Android Marshmallow (6.0), so you'll also need to build against this target Button Merchant Library level.

<activity name=".MainActivity">
            <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW"/>
                <data android:scheme="https"/>
                <data android:host=""/>
                <data android:pathPattern=".*"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE"/>

Button hosts the Digital Asset Links JSON file for your subdomain. You can add your package name and sha256 certificate fingerprints to your app configuration in the Button dashboard.

Web Links

Use the following command to generate the fingerprint via the Java keytool:

keytool -list -printcert -jarfile  <APK_FILE>  | grep SHA256

Now, your link should open your app without ever opening your browser when the app is installed. Note: by supporting web associated app links you will prevent the Intent Chooser when opening the URL and your app will open automatically.

Handle Post-install Deeplinks

In the Activity onCreate() method for whichever activity is started on first launch, handle any post-install deeplinks by calling the handlePostInstallIntent() method.

import com.usebutton.sdk.ButtonMerchant

class MainActivity : Activity() {
  override fun onCreate() {

    ButtonMerchant.handlePostInstallIntent(this) { intent, t ->
            if (intent != null) {
            } else if (t != null) {
                Log.e(TAG, "Error checking post install intent", t)


import com.usebutton.sdk.ButtonMerchant;

public class MainActivity extends Activity {
  public void onCreate() {

      ButtonMerchant.handlePostInstallIntent(this, new PostInstallIntentListener() {
          public void onComplete(@Nullable Intent intent, @Nullable Throwable t) {
              if (intent != null) {
              } else if (t != null) {
                  Log.e(TAG, "Error checking post install intent", t);

Traffic from the Google Play store can result in users opening your app without any deeplink path or parameters. Button's Deferred Deeplink product closes this gap by recovering the link the user was originally following based on device fingerprinting.

After a fresh install, the user may both have an attributed source, and a destination deep link which needs to be retrieved from the Button API.

This is achieved using a single call in the Merchant library — the Merchant library will ensure that this network call is only performed when it is possible to have a response (e.g. after first open) so you can safely call it as much as is needed.

The Merchant library will automatically store the attribution from the received URL, so there’s no need to pass it back to trackIncomingURL, but you will need to route the user to the url that is returned, if present.

Proguard Rules

If your app is using Proguard (minifyEnabled true in your build.gradle) make sure that the proguard rules below are in effect in your rules file. This file is usually located in yourapp/, or its location is specified in build.gradle, look for proguardFiles in your default or variant configuration (note: this can be multiple files).