Skip to content

Getting started

Prerequisites

The SDK requires at least API Level 23.

Gradle Dependency

In your projects root build.gradle add the bittiq maven repository:

allprojects {
    repositories {
        ...
        maven {
            url "https://089432699554-assets.s3.eu-central-1.amazonaws.com/SDK/Android"
        }
    }
}

Next add the dependency to the modules build.gradle:

dependencies {
    implementation 'com.bittiq:sdk:<latest_version>' // Production

    // Or if you want to test the sdk with mocked responses use:
    implementation 'com.bittiq:sdk-mock:<latest_version>' // Mock
}

For the latest version see the changelog.

Initialize SDK

You need to initialize the SDK before you're able to use it. This is normally done somewhere inside your Application subclass and should only be called once during the lifetime of the application. The way the SDK needs to be initialized depends on if you're using the mocked version or not:

Production

BittiqSdk.init(this, "https://{subdomain}.api.bittiq.cloud", "APIKEY", tokenResolver)

For more information on the tokenResolver see the section below.

Mock

MockBittiqSdk.init(this)

TokenResolver

If you're going to use the authentication methods provided by the Bittiq SDK (like login and resetPin) and therefore directly using the Bittiq's authentication service from within the app you can set the tokenResolver to null. Otherwise the TokenResolver can be used to provide the SDK with Bittiq access tokens that are acquired through your own API.

The implementation of the token resolver contains a single method: fun resolve(): Tokens. This method is called on a background thread so it's safe to do a synchronous network request. The returned object Tokens has to contain a valid and non-cached access and refresh token. Returning null from this method means that the TokenResolver couldn't resolve tokens, causing the original call to fail with a BittiqClientException with error code auth_access_denied.

ProGuard

If you are using ProGuard the needed rules are included automatically.