Connect to Ignite
When connecting to Ignite, ensure the Host App is in the foreground, active, and visible to the user. DT sends callbacks on the thread that the initialization was executed on.
There are no restrictions on the lifecycle owners for the connection: Activity, Fragment, Service, ViewModel, etc. However, do not connect to Ignite from classes or methods that might be called while the Host App is in the background, such as the Application class or broadcast receivers. Connecting in this manner causes multiple unnecessary connection attempts, potential resource conflicts, and unexpected behaviors when receiving broadcasts in the background.
Authentication occurs internally as part of the connection process. The SDK sends the onConnected() callback only after the connection is established and authentication succeeds. You can safely begin calling API methods after receiving onConnected().
To connect to Ignite via the SDK:
Declare and create an instance of
IIgniteService:
lateinit var igniteService: IIgniteService
// ...
// After SDK is initialised the IgniteService instance is returned.
// It can also be retrieved later using IgniteServiceSdk.instance()
// NOTE: `clientSecret` can be empty for initial integration
igniteService = IgniteServiceSdk.init(context, clientSecret)Call the
connect()method:
IgniteServiceSdk.instance().connect(object: IConnectionCallback {
override fun onConnected() {
// Connection with Ignite is established
Toast.makeText(applicationContext, "Connected.", Toast.LENGTH_SHORT).show()
}
override fun onDisconnected(message: String?) {
Toast.makeText(applicationContext, "Disconnected from Ignite Service: $message", Toast.LENGTH_SHORT).show()
}
})
// or
igniteService.connect(this)Example
Troubleshooting Connections
If your Host App is unable to connect to Ignite, you may receive one of the following error messages:
Connection failed to unknown reason
Ignite is not present in the device.
Authentication Exception: Can not create session
Client ID, Client Secret, or package name does not match what was given for DT Configuration.
Authentication Exception Code -2
Host App signing certificate fingerprint does not match with what was provided for DT Configuration.
Last updated

