Get Started on

Get Started

Welcome to the Button Android Getting Started guide. This guide will walk you through adding the SDK to your app and will prepare you to use any of the Button Publisher products. We will:

  • Include the Button SDK in your app
  • Start the Button SDK
  • Configure User Attribution

From here you can begin using Button Purchase Path or Button Actions.

Add the Button SDK

JFrog Bintray

The easiest way to include the Button SDK is by using Gradle. To do this, simply add the Button SDK to your app's build.gradle file in the dependencies.

compile 'com.usebutton:android-sdk:5+'

Note: We strictly follow semantic versioning, but sometimes compatibility issues can still arise. It’s best practice to use the latest version and update your build.gradle each time a new SDK version is available.

Allow JFrog Bintray access to your project's build.gradle file and add the Google Maven repository.

allprojects {
    repositories {
        maven {
          url ""

Add Button to your app's build.gradle file so it looks as below.

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('', {
        exclude group: '', module: 'support-annotations'
    compile ''
    testCompile 'junit:junit:4.12'

    // Button SDK
    compile 'com.usebutton:android-sdk:5+'

Start the SDK

To initialize a Button in your app, your app ID is needed, which can be found in the Button Dashboard. If you're a loyalty Publisher, you must attribute your users' IDs through Button. You must initialize your Button in your AndroidManifest.xml within the application tag.

In the AndroidManifest.xml file, add Button within the application tag to initialize your Button.


      <!-- your activities  -->

    <!--Button SDK-->

Import the SDK at the top of the file and start it. This should be called when your application class is created.

import com.usebutton.sdk.Button

class MyApplication : Application() {
    override fun onCreate() {
import com.usebutton.sdk.Button;

public class MyApplication extends Application {
  public void onCreate() {

Configure user attribution

You can associate all Button activity with one of your users by setting their User Identifier. This can either be your user ID, email or a stable hash of one. You can use this later to look up orders, activity and identify the user in Webhooks.


If your app offers logout functionality, you should make sure to invoke the SDK's logout feature during your logout handler.


Note: You will also need to set the user identifier upon completion of a user log in or sign up.

For more information on user attribution, see this guide.

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).

-keepattributes Exceptions,InnerClasses,EnclosingMethod
-keep class com.usebutton.** { *; }
-keepclassmembers class * implements android.os.Parcelable {
    static ** CREATOR;
-keep class { public *; }

Run your app

You should see printed to the console:

Configured successfully App ID: <YOUR_BUTTON_APP_ID>

If you don't, try using debug mode to figure out why.

Start using Button

You're now ready to start using Button. What would you like to do?