initialize
fun initialize(context: Context, addKoinAndroidLogger: Boolean = false, koinAndroidLoggerLevel: Level = Level.INFO, extraKoinModules: List<Module> = emptyList())
Initializes the Smart1 SDK with the required Koin dependency injection setup.
This method configures Koin with all necessary modules for the SDK to function properly.
Parameters
context
Context The Android application context. Pass this from your Application class.
addKoinAndroidLogger
Boolean Whether to add the Koin Android logger. Default is false.
koinAndroidLoggerLevel
Level The logging level for the Koin Android logger. Default is Level.INFO.
extraKoinModules
List<Module> Additional Koin modules to include. Default is an empty list.
Example of simple implementation
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
Smart1SDK.initialize(this)
}
}Content copied to clipboard
Example of advanced implementation
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
Smart1SDK.initialize(
this,
true,
Level.DEBUG,
listOf(
module {
singleOf(::MyViewModel)
}
)
)
}
}Content copied to clipboard