Android SDK
Information about the Android SDK
The Android SDK includes a core native library (closed-source) and a reference UI implementation provided in source code format. This setup allows you to fully customize the UI according to your application’s requirements. While this page provides an overview, you can read more detailed documents at Android SDK Documentation.
The Android SDK comes in two variants:
Online: This variant is small in size, but it needs to connect with the server for SensePrint eID verification/decryption.
Offline: This variant larger in size, but it can be used to verify/decrypt SensePrint eIDs with no network connectivity and completely on a mobile device.
Both variants utilize the same reference UI implementation. This means the same Kotlin source code is used for both variants. In the provided Android project you can use the following gradle task to switch between the variants:
This gradle task updates the project's dependencies, app name, application id, app icons and changes the Constants for the respective variant. After performing a gradle sync the app can be build in the selected variant.
Constants
The Constants class contains different app-wide configuration values that can customize the flow of the app. The following are notable constants for customization:
Common to both online/offline SDKs
GENERATION_CAPTURE_MODE
- the face capture method used while generating a SensePrint. Can be one ofFaceCaptureMode.ActiveCaptureFrontCamera
,FaceCaptureMode.PassiveCaptureFrontCamera
, orFaceCaptureMode.PassiveCaptureBackCamera
.VERIFICATION_CAPTURE_MODE
- the face capture method used while verifying a SensePrint. Can be one ofFaceCaptureMode.ActiveCaptureFrontCamera
,FaceCaptureMode.PassiveCaptureFrontCamera
, orFaceCaptureMode.PassiveCaptureBackCamera
.SENSEPRINT_VERIFIER_AUTH_KEY
- It is possible to generate SensePrint eID QR codes targeted at a specific verifier. See the section on Generating your first SensePrint eID QR. When theverifiers_auth_key
attribute is specified while generating the QR, that QR code can only be read by a specific verifier. Set the value ofSENSEPRINT_VERIFIER_AUTH_KEY
to the value you used forverifiers_auth_key
while generating the QR code.
Online SDK only
API_SERVER_URL
- this value should point to your server that you deployed using the Docker. If you exposed the server usingngrok
use the Ngrok URL value.MOBILE_AUTH_HEADER
- this value should be set to themobile_api_key
value you used in thesecrets.json
file while starting the Docker container for the server. If you are using a JWT Token for mobile authorization, this should be set toBearer your_jwt_token_from_server
Offline SDK only
ISSUERS_PUBLIC_KEY
- this value is present only in the offline SDK. If you started the server in Certificate Authority mode by setting theissuers_private_key
, then the server will issue signed SensePrints. In order to verify them, you must set the correspondingISSUERS_PUBLIC_KEY
in the Constants.
Important Activities
SplashActivity Responsible for initializing the SDK and loading the necessary Machine Learning models into memory. The SplashActivity culminates by loading the MainActivity.
MainActivity A simple interface displaying entry points for SensePrint eID QR generation, verification and reading. Users can interact with buttons to proceed with either operation.
QRScanActivity This activity can be invoked with or without intent extras. When invoked without any extras, the activity will interpret the launch as an attempt to capture QR data that will subsequently be decrypted via a face scan. Based on the capture type which is set up in
Constants.kt
configuration, after scanning a QR code (when invoked without intent data), the app will proceed toPreScanningActiveCaptureActivity
activity for Active Face Capture orPreScanningPassiveCaptureActivity
for Passive Face Capture. When theQRScanActivity
is invoked with an extra, the activity will attempt to read the non-face-encrypted regions of a SensePrint eID QR code and show that data by passing it in an intent and launching theReaderDetailActivity
.ActiveFaceCaptureActivity This activity may be invoked with or without intent extras. When invoked with an extra containing the SensePrint bytes (from the
QRScanActivity
), the activity will attempt to decrypt the SensePrint bytes and pass the metadata along to thePersonDetailActivity
. When invoked without any extras, the activity will pass the captured image via an intent by launching theGenerateQRActivity
.PassiveFaceCaptureActivity This activity works in exactly the same way as the
ActiveFaceCaptureActivity
. The only difference is that it captures a single good image from the session.ReaderDetailActivity This activity gets clear text data (non-face encrypted) in an intent and displays it on the screen for viewing.
PersonDetailActivity This activity shows the eID attributes that are passed to it via an intent extra.
GenerateQRActivity When invoked from the
ActiveFaceCaptureActivity
orPassiveFaceCaptureActivity
, this activity prompts for input of eID attributes such as name, ID etc. Upon accepting the input, the activity invokes theShowQRActivity
to show the generated QR code.ShowQRActivity This activity accepts QR code bytes as an intent extra, and shows a generated QR code containing those bytes on the screen.
Additional Notes
The SDK is designed for modularity, allowing full customization of the user interface and integration flows while maintaining core functionality within a closed-source native library.
This document serves as a guide to understand and integrate the Android SDK into your application. Be sure to configure the constants accurately to align with your deployment setup and security requirements.
Last updated