Requirements
Android 7.0 (API 24) or later, compileSdk 36, Kotlin 2.1 or later. The library supports 16 KB memory pages.Install
build.gradle.kts
mavenCentral() is in Android projects by default. Minification needs nothing from you: the library’s consumer rules keep what the core loads.
Configuration
SessionConfig has the same fields as on iOS. See the configuration table.
Run a session
Things to know
- The foreground service is a
shortService. Start it only afterloginreturns and stop it on every path. From API 31 Android refuses to start it while your app is in the background, which is why the snippet catches the exception. Android ends it after about three minutes. - One session at a time.
ZkTlsSessionServiceholds one session. Guard as the snippet does. - Shared WebView state.
CookieManager, web storage and the WebView cache are process-wide. The login clears all three before and after, so do not run a login while your own WebView data matters. - The notification reads “Verifying” in a channel named “Verification”. Override
zktls_session_notification_title,zktls_session_channel_nameand the drawablezktls_session_notification_iconto translate or rebrand it. - Error text.
SdkException.Transportand.Policycarry their text ine.v1. Match and loge.v1, note.message. - Other exceptions. A fault inside the SDK that is not an
SdkExceptionarrives asInternalException. Catch it and report it.