Skip to main content

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 after login returns 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. ZkTlsSessionService holds 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_name and the drawable zktls_session_notification_icon to translate or rebrand it.
  • Error text. SdkException.Transport and .Policy carry their text in e.v1. Match and log e.v1, not e.message.
  • Other exceptions. A fault inside the SDK that is not an SdkException arrives as InternalException. Catch it and report it.