Add to Gradle

Add the SDK to your android app’s build.gradle file

If you’re pulling from Vouchrs Maven

In your app’s build.gradle file. Add Vouchrs Artifactory & credentials

repositories {
    ...
    maven {
        url "https://vouchrsdk.jfrog.io/vouchrsdk/maven-release/"
        credentials {
            username = vouchr_sdk_username
            password = vouchr_sdk_password
        }
    }
    maven { url 'https://jitpack.io' }
}

If you’re using local AAR modules

In your app’s build.gradle file. Add mavenLocal() to your repositories. For full instructions see here

repositories {
    ...
    mavenLocal()
    maven { url 'https://jitpack.io' }
}

Ensure you are compiling with at least java8

android {
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

Then import the Vouchr SDK libraries, Facebook’s conceal library, and rxjava.

dependencies {
    api 'com.vouchr:create:1.1.0'
    api 'com.vouchr:claim:1.1.0'
    api 'com.vouchr:common:1.1.0'
    api 'com.vouchr:doodle:1.1.0'

    implementation 'com.facebook.conceal:conceal:1.1.3@aar'
    implementation "io.reactivex:rxandroid:1.2.1"
    implementation "io.reactivex:rxjava:1.3.8"
}

Build the Engine

Finally setup Engine in your Application class

import com.surpriise.vouchrcommon.engine.Engine;

public class TestApplication extends Application {

    private final String SDK_ID = ""; // This will be given to you by Vouchr
    private final String VOUCHR_BASE_URL = ""; // This will be give to you by Vouchr

    @Override
    public void onCreate() {
        super.onCreate();

        Engine.Builder engineBuilder = new Engine.Builder(VOUCHR_BASE_URL, SDK_ID);
        engineBuilder.setCreateConfig(new CreateConfiguration.Builder(this).build())
        engineBuilder.build().startup(this);
    }

}
import com.surpriise.vouchrcommon.engine.Engine

class TestApplication : Application() {
    
    private val SDK_ID = "" // This will be given to you by Vouchr
    private val VOUCHR_BASE_URL = "" // This will be give to you by Vouchr

    override fun onCreate() {
        super.onCreate()
        
        val engineBuilder = Engine.Builder(VOUCHR_BASE_URL, SDK_ID)
        engineBuilder.setCreateConfig(CreateConfiguration.Builder(this).build())
        engineBuilder.build().startup(this)
    }
}

Next Steps

Send a Voucher

Receive a Voucher