Android SDK
Requirements
- Android SDK Version 21+
- API key or an ephemeral token
- A Stax card reader
Installation
The Stax Android SDK is distributed via JitPack. To add JitPack as a repository to your project, you can modify your project-level gradle files to include jitpack.io as a Maven repository.
build.gradle
repositories {
...
maven { url '<https://jitpack.io'> }
}
build.gradle.kts
repositories {
...
maven(url = '<https://jitpack.io'>)
}
After adding JitPack as a repository, you can add the Stax Android SDK as a dependecy to your project.
implementation 'com.github.fattmerchantorg:fattmerchant-android-sdk:2.6.0'
You can specify the exact commit or branch to use a pre-release version.
Android SDK releases are tracked on our GitHub project.
Initializing
To initialize the Stax SDK, you will need to create an InitParams object that contains your app’s Context, Application, and API Key. Once you’ve created the InitParams object, you can call Omni.initialize() with the params, a success callback, and a failure callback.
val context = // Application context
val application = // Application instance
val apiKey = // Stax API Key
Omni.initialize(
params = InitParams(context, application, apiKey),
completion = {
// Callback called on successful initialization
},
error = { exception ->
// Callback called on failed initialization
}
)
You can now use the Omni. shared () singleton. The Stax Android SDK sample project provides an example of initializing the SDK.
Updated 7 months ago