To show Sarbacane Chat in your Android app, add the SDK with Gradle, then initialize it with your chatbox's public key. This article is for the app's developer.
A Sarbacane Chat licence assigned to your user, with access to Settings.
An Android project with a minimum of Android 5.0 (API 21).
In Sarbacane Chat, at the bottom of the left menu, click Settings. Under Chatbox, open Deploy, then the Android app tab.
On the right, under Public brand key:, click Copy. The key starts with "spk-".
Important: use the public key. The Secret brand key: must never appear in the app's code.
In the project's build.gradle file, add the JitPack repository:
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}In the app module's build.gradle file, add the dependency, then sync the project:
implementation 'com.github.xenoapp:android-sdk:1.0'In MainActivity, in the onCreate method, initialize the SDK with your public key:
import app.xenoapp.sdk.Xeno
Xeno.initialize(this, "YOUR_PUBLIC_KEY")Call Xeno.show() where the chatbox should open, for example when a button is tapped:
myButton.setOnClickListener { Xeno.show() }Note: the SDK and the class use the technical name XenoApp / Xeno. This is expected. The INTERNET permission is already declared by the SDK. To pass the identity of the logged-in user, pass a XenoIdentity object to initialize (for example XenoIdentity().setId(…).setName(…).setEmail(…)).
Launch the app and tap the button: the chatbox opens. Send a test message: it arrives in Inbox.
Check in this order:
The JitPack repository is added to the project's build.gradle.
The dependency is com.github.xenoapp:android-sdk:1.0, and the project has been synced.
initialize is called before show().
The key is the public key ("spk-…"), copied without spaces.
If the problem persists, contact our Sarbacane Chat experts at [email protected].