On-device toggle
The SDK ships with on-device active-liveness UI: as the user holds the camera, ML Kit face detection runs locally to give live UX feedback ("face detected", "blink now", "turn left"). The server remains the source of truth for the verdict.
Toggle via EkycConfig.enableOnDeviceLiveness:
final sdk = EkycSdk(EkycConfig(
// ...
enableOnDeviceLiveness: false, // disable on-device entirely
));
What enableOnDeviceLiveness: true does
- ML Kit face detection runs on every preview frame
- The widget overlays prompts ("blink now", etc.)
- For challenge mode, the on-device detector waits for the user to complete the action before capturing frames
- Captured frames go to
/v1/liveness/checkfor the authoritative verdict
What enableOnDeviceLiveness: false does
- The widget renders a plain camera preview with a capture button
- No on-device ML
- Frames go to
/v1/liveness/checkdirectly - Server runs the same anti-spoof + deepfake checks regardless
When to disable
- Older devices where ML Kit performance is poor
- Server-only flows where you want to minimize binary size impact (the ML Kit dependency adds ~10MB to the APK regardless of toggle — it's a runtime gate, not a compile-time one)
- A/B testing the user-experience impact of on-device feedback
What it does NOT do
The toggle does not change the server-side result. The same endpoints run the same models. On-device is purely a UX layer.
If on-device says "live" and the server says "spoof", trust the
server. The SDK's verdict is result.isLive from the API, not
anything inferred locally.