4. Initialization
This document refers to deprecated parts of the platform and has been left intact to help customers with legacy integrations. In order to access the latest platform features and documentation, please go to https://docs.sentiance.com.
Initialization is a very important step; before initialization, none of the methods on the Sentiance SDK interface will work, with the exception of getInstance()
, init()
and getInitState()
.
Create an Application Class
Initialization must be done in the onCreate()
method of your Application
class. If you don't already have a custom application class, first create a new class that extends Application
.
Then reference this new class in the application tag of the AndroidManifest.xml
Call the SDK init Method
In the onCreate()
method of your Application
class, call init()
and pass the SdkConfig
you created in the previous step, plus an instance of OnInitCallback
to handle the initialization result.
Upon successful initialization, onInitSuccess()
will be called. If it fails, onInitFailure()
will be called with an appropriate InitIssue
.
The init()
call must be executed before onCreate()
returns. Therefore, you must call it synchronously on the main thread. If you plan to add a remote flag to control the initialization (e.g. Firebase Remote Config), make sure the check is synchronous (e.g. using a cached flag).
See here to understand more about why this is important. An example app demonstrating this can be found on our Github.
To learn more about initialization, see the SDK Initialization section.
Last updated