Skip to main content

Configure

Call configure() once, early in your app lifecycle. This is shared code:
import com.encorekit.kmp.Encore
import com.encorekit.kmp.models.LogLevel

Encore.configure(
    apiKey = "pk_your_api_key",
    logLevel = LogLevel.DEBUG, // NONE, ERROR, WARN, INFO, DEBUG
)
Duplicate calls to configure() are ignored with a warning.

Android: Platform Glue

Android requires two additional calls because the native SDK needs a Context to initialize and an Activity reference to present offer UI. These go in your platform-specific code, not in shared:
// Application.kt
import com.encorekit.kmp.Encore
import com.encorekit.kmp.configure

class MyApp : Application() {
    override fun onCreate() {
        super.onCreate()
        Encore.configure(this, "pk_your_api_key")
    }
}
// MainActivity.kt
import com.encorekit.kmp.Encore
import com.encorekit.kmp.setActivity

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        Encore.setActivity(this)
    }

    override fun onDestroy() {
        Encore.setActivity(null)
        super.onDestroy()
    }
}
On Android, use the configure(context, apiKey) extension instead of the shared configure(apiKey) — it passes the Application context to the native SDK. iOS needs no platform glue.

Next Steps