Using the SDK on Android
Setup at Application start
Start Cloud-Inject SDK
In your Android app Application
class, you need to activate the Kotzilla platform with:
CloudInjectSDK.setup(this)
- to start the Kotzilla SDK- From Koin configuration, use
analyticsLogger()
to activate remote Koin logging
class MainApplication : Application() {
override fun onCreate() {
super.onCreate()
// Start Kotzilla SDK
CloudInjectSDK.setup(this)
// Start Koin
startKoin {
// replace your logger with Kotzilla Analytics
analyticsLogger()
// Your Koin config here
}
}
}
Optional SDK Close
If needed, We can the SDK on application termination:
override fun onTerminate() {
super.onTerminate()
CloudInjectSDK.close()
}
Configure Koin Logger
You can continue to use your logger with analyticsLogger(<Logger>)
:
analyticsLogger(AndroidLogger(INFO))
Cloud-Injct SDK Features
Send Logs for your timeline (since 0.9.0)
To help complete your app context data, you can add messages to your timeline, CloudInjectSDK.log
:
CloudInjectSDK.log("a message ...")
This will add the message to your timeline.
you can use static import of CloudInjectSDK
to use directly log()
function
Trace performances for code block (since 0.9.0)
You may need to track performances of special code, and add it to your timeline. Use the CloudInjectSDK.trace
function:
CloudInjectSDK.trace("my_code_block"){
// My code to benchmark here ...
myComponent.MyHeavyCall()
}
This will add the code benchmark to your timeline.
you can use lazy version lazyTrace("tag") { }
, and allow delegate usage by lazyTrace(){ ... }
Add Session Properties (since 0.9.0)
To help add context to your app data, you can add properties to the current session, CloudInjectSDK.setProperties
:
CloudInjectSDK.setProperties(
"my_string" to "a_string",
"my_int" to 1,
"my_double" to 1.0,
"my_bool" to true,
)
This will add the properties to session data.
Set User Id Properties (since 0.9.0)
To help track your session data, you can set a user Id to the current session, CloudInjectSDK.setUserId
:
CloudInjectSDK.setUserId("user_123")
This will add the property to session data.