Android Core SDK¶
Overview¶
The Core SDK is the foundation module of the Biometrid SDK. It handles SDK initialization, process management, step navigation, flow retrieval, and real-time socket communication. All other Biometrid modules require Core SDK to be initialized first.
Prerequisites¶
- Android
minSdk26 or higher - A valid Biometrid
url,appidentifier andcredential - Access to the Biometrid Cloudsmith maven repository
Installation¶
Add the Cloudsmith maven repository to settings.gradle.kts:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url = uri("https://dl.cloudsmith.io/public/biometrid/mobile/maven/") }
}
}
Declare the Core dependency in your module build.gradle.kts:
dependencies {
implementation("com.biometrid:biometridstandard:3.2.0")
}
com.biometrid:biometridstandard is the mandatory base — every step module declares it as a transitive compile dependency, so you only need to add it explicitly when you use Core APIs directly.
Modular structure¶
Each verification step ships as a pair: an AAR with the Kotlin/Compose code and a POM-only "bridge" that declares the native SDKs the step depends on. Add both for every step you use — the bridge is required, the step AAR alone will fail to link at runtime.
Liveness¶
// settings.gradle.kts — repos declared by the bridge POM
dependencyResolutionManagement {
repositories {
maven { url = uri("https://dl.cloudsmith.io/public/biometrid/face01-liveness/maven/") }
maven { url = uri("https://raw.githubusercontent.com/iProov/android/master/maven/") }
}
}
// module build.gradle.kts
dependencies {
implementation("com.biometrid:biometridstandard-liveness:3.2.0")
implementation("com.biometrid:biometridstandard-liveness-bridge:3.2.0")
}
The bridge pulls in the face01 active liveness SDK and face06.
AutoCapture¶
No extra maven repos required — LiteRT and ONNX Runtime resolve from Maven Central.
dependencies {
implementation("com.biometrid:biometridstandard-autocapture:3.2.0")
implementation("com.biometrid:biometridstandard-autocapture-bridge:3.2.0")
}
Initialization¶
The Core SDK is accessed through the BiometridStandard singleton object. Initialize the SDK by providing a callback that contains your credentials and handles success/failure events.
import com.biometrid.biometridstandard.BiometridStandard
import com.biometrid.biometridstandard.callbacks.BiometridStandardInitCallback
import com.biometrid.biometridstandard.enums.Language
import com.biometrid.biometridstandard.model.BiometridErrorInfo
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
val initCallback = object : BiometridStandardInitCallback {
override val url: String = "https://api.uat.biometrid.com"
override val app: String = "your-application-uuid"
override val credential: String = "your-credential-uuid"
override val language: Language = Language.English
override val customHeaders: Map<Any?, *>? = null
override fun initializationSuccess() {
// SDK initialized successfully
}
override fun initializationFailure(error: BiometridErrorInfo) {
// Handle initialization error
val errorCode = error.code
val errorMessage = error.message
}
}
CoroutineScope(Dispatchers.Main).launch {
BiometridStandard.initialize(initCallback)
}
Available Methods¶
initialize¶
suspend fun initialize(initCallback: BiometridStandardInitCallback)
Initializes the SDK with the provided credentials and configuration. Must be called before any other SDK operation.
| Parameter | Type | Description |
|---|---|---|
initCallback |
BiometridStandardInitCallback |
Callback containing credentials and event handlers |
set¶
fun set(callback: BiometridStandardProcessCallback)
Sets the process callback to receive results from process operations (create, step navigation, flow retrieval, socket events).
| Parameter | Type | Description |
|---|---|---|
callback |
BiometridStandardProcessCallback |
Callback to receive process operation results |
createProcess¶
suspend fun createProcess()
Creates a new verification process. Results are delivered through the BiometridStandardProcessCallback.
getCurrentStep¶
suspend fun getCurrentStep(processId: String)
Retrieves the current step of a process.
| Parameter | Type | Description |
|---|---|---|
processId |
String |
The identifier of the process |
previousStep¶
suspend fun previousStep(processId: String)
Navigates to the previous step in the process flow.
| Parameter | Type | Description |
|---|---|---|
processId |
String |
The identifier of the process |
updateStep¶
suspend fun updateStep(processId: String, data: Map<String, Any>?, includeResponseData: Boolean)
Submits data for the current step and advances the process.
| Parameter | Type | Description |
|---|---|---|
processId |
String |
The identifier of the process |
data |
Map<String, Any>? |
Key-value data to submit for the current step |
includeResponseData |
Boolean |
If true, appends response=data query to receive data in the response |
updateStepMultipart¶
suspend fun updateStepMultipart(processId: String, formBuilder: FormBuilder.() -> Unit, includeResponseData: Boolean)
Submits step data as multipart form data. Use this method when you need to upload files or binary data as part of a step update.
| Parameter | Type | Description |
|---|---|---|
processId |
String |
The identifier of the process |
formBuilder |
FormBuilder.() -> Unit |
Builder to construct multipart form data |
includeResponseData |
Boolean |
If true, appends response=data query to receive data in the response |
getFlow¶
suspend fun getFlow()
Retrieves the complete flow definition including all steps and their configurations.
getCustomization¶
fun getCustomization(): Customization?
Returns the customization settings received during initialization (colors, icons, typography, images, translations).
setRelateProcessId¶
fun setRelateProcessId(processId: String)
Associates a related process ID for cross-process references.
| Parameter | Type | Description |
|---|---|---|
processId |
String |
The related process identifier |
connectSocket¶
fun connectSocket(processId: String)
Establishes a real-time socket connection for the given process. Socket events are delivered through the socketEvent method of BiometridStandardProcessCallback.
| Parameter | Type | Description |
|---|---|---|
processId |
String |
The process identifier to connect the socket for |
Callback Interfaces¶
BiometridStandardInitCallback¶
interface BiometridStandardInitCallback {
val url: String
val app: String
val credential: String
val language: Language
val customHeaders: Map<Any?, *>?
fun initializationSuccess()
fun initializationFailure(error: BiometridErrorInfo)
}
| Property/Method | Type | Description |
|---|---|---|
url |
String |
Base URL for the Biometrid API |
app |
String |
Application identifier |
credential |
String |
Authentication credential |
language |
Language |
SDK language setting |
customHeaders |
Map<Any?, *>? |
Optional custom HTTP headers |
initializationSuccess() |
Function | Called when initialization succeeds |
initializationFailure(error) |
Function | Called when initialization fails |
BiometridStandardProcessCallback¶
interface BiometridStandardProcessCallback {
fun createProcessSuccess(processId: String?)
fun createProcessFailure(error: BiometridErrorInfo)
fun getCurrentStepSuccess(response: StepResponse)
fun getCurrentStepFailure(error: BiometridErrorInfo)
fun previousStepSuccess(response: StepResponse)
fun previousStepFailure(error: BiometridErrorInfo)
fun updateStepSuccess(response: StepResponse)
fun updateStepFailure(error: BiometridErrorInfo)
fun updateStepMultipartSuccess(response: StepResponse)
fun updateStepMultipartFailure(error: BiometridErrorInfo)
fun getFlowSuccess(response: GetFlowResponse)
fun getFlowFailure(error: BiometridErrorInfo)
fun socketEvent(event: String, response: JsonElement?)
}
| Method | Description |
|---|---|
createProcessSuccess(processId) |
Process created successfully, returns the process ID |
createProcessFailure(error) |
Process creation failed |
getCurrentStepSuccess(response) |
Current step retrieved successfully |
getCurrentStepFailure(error) |
Failed to retrieve current step |
previousStepSuccess(response) |
Navigated to previous step successfully |
previousStepFailure(error) |
Failed to navigate to previous step |
updateStepSuccess(response) |
Step updated successfully |
updateStepFailure(error) |
Failed to update step |
updateStepMultipartSuccess(response) |
Multipart step updated successfully |
updateStepMultipartFailure(error) |
Failed to update multipart step |
getFlowSuccess(response) |
Flow retrieved successfully |
getFlowFailure(error) |
Failed to retrieve flow |
socketEvent(event, response) |
Real-time socket event received |
Data Models¶
BiometridErrorInfo¶
@Serializable
data class BiometridErrorInfo(
val code: String? = null,
val message: String? = null,
val data: JsonElement? = null
)
StepResponse¶
@Serializable
data class StepResponse(
val data: StepResponseData? = null,
val meta: Meta? = null,
val status: Boolean? = null
)
@Serializable
data class StepResponseData(
val processID: String? = null,
val flowID: String? = null,
val step: Step? = null,
val path: List<Path>? = null,
val completedSteps: JsonArray? = null
)
@Serializable
data class Step(
val id: String? = null,
val name: String? = null,
val action: StepResponseAction? = null,
val settings: StepResponseSettings? = null
)
@Serializable
data class StepResponseAction(
val type: String? = null,
val channel: String? = null,
val fields: List<Field>? = null,
val provider: Provider? = null,
val settings: StepResponseActionSettings? = null,
val attributes: StepResponseActionAttributes? = null
)
GetFlowResponse¶
@Serializable
data class GetFlowResponse(
val data: GetFlowData? = null,
val meta: Meta? = null,
val status: Boolean? = null
)
@Serializable
data class GetFlowData(
val id: String? = null,
val name: String? = null,
val steps: List<GetFlowStep>? = null
)
Customization¶
@Serializable
data class Customization(
val colors: Colors? = null,
val icons: Icons? = null,
val typography: Typography? = null,
val images: Images? = null,
val translations: Translations? = null,
val settings: Settings? = null
)
Enums¶
Language¶
enum class Language(val value: String) {
English("en-GB"),
Portuguese("pt-PT"),
French("fr-FR"),
Spanish("es-ES"),
Italian("it-IT")
}
Error Handling¶
Errors are returned as BiometridErrorInfo objects with the following properties:
code- Error code string prefixed withMSC(e.g.,MSCprefix indicates a Core module error)message- Human-readable error descriptiondata- Optional additional error data as JSON
Usage Example¶
class MyActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val initCallback = object : BiometridStandardInitCallback {
override val url = "https://api.uat.biometrid.com"
override val app = "my-application-uuid"
override val credential = "my-credential-uuid"
override val language = Language.English
override val customHeaders: Map<Any?, *>? = null
override fun initializationSuccess() {
setupProcessCallback()
}
override fun initializationFailure(error: BiometridErrorInfo) {
Log.e("Biometrid", "Init failed: ${error.message}")
}
}
CoroutineScope(Dispatchers.Main).launch {
BiometridStandard.initialize(initCallback)
}
}
private fun setupProcessCallback() {
val processCallback = object : BiometridStandardProcessCallback {
override fun createProcessSuccess(processId: String?) {
processId?.let { id ->
CoroutineScope(Dispatchers.Main).launch {
BiometridStandard.getCurrentStep(id)
}
}
}
override fun createProcessFailure(error: BiometridErrorInfo) {
Log.e("Biometrid", "Create process failed: ${error.message}")
}
override fun getCurrentStepSuccess(response: StepResponse) {
val step = response.data?.step
// Handle the current step based on step.action?.type
}
override fun getCurrentStepFailure(error: BiometridErrorInfo) {
Log.e("Biometrid", "Get step failed: ${error.message}")
}
override fun previousStepSuccess(response: StepResponse) { }
override fun previousStepFailure(error: BiometridErrorInfo) { }
override fun updateStepSuccess(response: StepResponse) { }
override fun updateStepFailure(error: BiometridErrorInfo) { }
override fun getFlowSuccess(response: GetFlowResponse) { }
override fun getFlowFailure(error: BiometridErrorInfo) { }
override fun socketEvent(event: String, response: JsonElement?) {
// Handle real-time events
}
}
BiometridStandard.set(processCallback)
CoroutineScope(Dispatchers.Main).launch {
BiometridStandard.createProcess()
}
}
}