Initialization is pretty straightforward. There are no restrictions on the lifecycle owners for the connection: Activity, Fragment, Service, ViewModel etc. Callback will be triggered on the thread it was executed.

After successful initialization and authentication, SDK will persist an authorization token and refresh it as needed. The token will be used automatically for any requests that require authorization. Initialization failure indicates that Ignite is not present on the device.

class ExampleActivity: AppCompatActivity(), IConnectionCallback {
    private lateinit var igniteService: IIgniteService

    override fun onCreate(savedInstanceState: Bundle?) {
        igniteService = IgniteServiceSdk.init(this, clientSecret = "")

    override fun onConnected() {
        Log.i(TAG, "Connected to Ignite Service")

    override fun onDisconnected(message: String?) {
        Log.i(TAG, "Disconnected from Ignite Service: $message")

    override fun onAuthenticated() {
        // Toast cannot be called on other threads except the main one
        Handler(Looper.getMainLooper()).post {
            Toast.makeText(applicationContext, "Authenticated", Toast.LENGTH_SHORT).show()

    override fun onDestroy() {
        // Disconnect from the service if needed
    companion object {
        const val TAG = "SDK"

Back to Top ⇧