---
Source: https://docs.microblink.com/platform/sdk/android/migrate-v2
Title: Migrate to v2
Description: Migrate your Microblink Platform Android SDK integration from v1 to v2
---

# Migrate to v2

This guide lists the changes you need to make in your Android app to move from v1 to v2 of the Android SDK.

The SDK no longer creates transactions: your backend does, and passes the result to your app.
Before you update the SDK, update your backend as described in the [Platform migration guide](../../migrate-v2.md), in particular [No proxy](../../migrate-v2.md#no-proxy) and [Consent](../../migrate-v2.md#consent).

## Installation

The artifact is unchanged: **com.microblink:microblink-platform**, from the same Maven repository.
Update its version to 2.0.0, through the new BOM, and add the scanning SDKs that your workflows need:

```kotlin title="build.gradle.kts"
dependencies {
    implementation(platform("com.microblink:microblink-platform-bom:2.0.0"))
    implementation("com.microblink:microblink-platform")

    // Only the ones your workflows need:
    implementation("com.microblink:blinkid-verify-ux") // document scanning and document verification
    implementation("com.microblink:blinkcard-ux")      // card scanning
    implementation("com.microblink:biometrics-ux")     // face capture
}
```

In v1, the SDK brought in the scanning SDKs.
In v2, your app adds them, without a version, so that the BOM sets it.
If a workflow has a step whose scanning SDK your app doesn't include, the verification fails with `EngineError.MissingScannerSdk`.

The SDK brings in the new `com.microblink:microblink-platform-engine` artifact, which contains the engine.
Don't add it separately, unless you want to build your own UI on the engine alone.

The minimum Android version is now **Android 8.0 (API level 26)**, up from Android 7.0 (API level 24).

## Starting a verification

The entry point is unchanged: you call `MicroblinkPlatform.startVerification`, and the SDK opens a separate activity for the verification screens.
What changes is the configuration you pass to it.
Instead of a workflow ID, proxy settings, and consent, you pass the `sdkConfiguration` your backend got when it created the transaction.

<Tabs groupId="sdk-version">
<TabItem value="v1" label="v1">

```kotlin
MicroblinkPlatform.startVerification(
    activity = this,
    configuration = MicroblinkPlatformConfig(
        mbpResultListener = object : MicroblinkPlatformResultListener {
            override fun onVerificationFinished(mbpResult: MicroblinkPlatformResult) {
                Log.d("MBP", "Transaction ${mbpResult.transactionId}: ${mbpResult.state}")
            }

            override fun onVerificationCanceled(cancelState: MicroblinkPlatformCancelState) {
                Log.d("MBP", "User canceled: ${cancelState.cancelReason}")
            }
        },
        mbpServiceSettings = MicroblinkPlatformServiceSettings(
            workflowId = "ID of the workflow to use",
            proxySettings = MicroblinkPlatformProxySettings(
                url = "URL of your proxy service"
            ),
            consent = MicroblinkPlatformConsent(
                userId = "unique user ID",
                isProcessingStoringAllowed = true,
                givenOn = System.currentTimeMillis()
            )
        )
    )
)
```

</TabItem>
<TabItem value="v2" label="v2" default>

```kotlin
// sdkConfiguration is the value your backend got from POST /api/v2/transaction.
MicroblinkPlatform.startVerification(
    activity = this,
    configuration = MicroblinkPlatformConfiguration(
        engine = EngineConfiguration(
            service = ServiceSettings(sdkConfiguration = sdkConfiguration)
        ),
        resultListener = object : MicroblinkPlatformResultListener {
            override fun onVerificationFinished(outcome: SessionOutcome.Verification) {
                Log.d("MBP", "Transaction ${outcome.transactionId}: ${outcome.state}")
            }

            override fun onVerificationCanceled(outcome: SessionOutcome.Canceled) {
                Log.d("MBP", "User canceled: ${outcome.reason}")
            }

            override fun onVerificationFailed(transactionId: String?, error: EngineError) {
                Log.d("MBP", "Verification failed: $error")
            }
        }
    )
)
```

</TabItem>
</Tabs>

## Configuration fields

Here's the whole configuration in v1 and in v2:

<Tabs groupId="sdk-version">
<TabItem value="v1" label="v1">

```kotlin
MicroblinkPlatformConfig(
    mbpResultListener = resultListener,
    mbpServiceSettings = MicroblinkPlatformServiceSettings(
        workflowId = "...",
        proxySettings = MicroblinkPlatformProxySettings(
            url = "...",
            startTransactionPath = "/transaction",
            cancelWorkflowPath = "/initialize/{workflowId}/cancel",
            workflowInfoPath = "/initialize/{workflowId}/info",
            additionalRequestHeaders = emptyMap(),
        ),
        consent = MicroblinkPlatformConsent(
            userId = "...",
            isProcessingStoringAllowed = true,
            isTrainingAllowed = false,
            givenOn = System.currentTimeMillis(),
        ),
        correlationId = null,
    ),
    mbpUiSettings = MicroblinkPlatformUiSettings(
        colorScheme = colorScheme,
        typography = MicroblinkPlatformTypography.default(),
        mbpImages = MicroblinkPlatformImages(),
        buttonShape = ButtonShape(CircleShape),
        documentScanningTypography = documentScanningTypography,
    ),
    mbpCardScanResultListener = cardScanResultListener,
)
```

</TabItem>
<TabItem value="v2" label="v2" default>

```kotlin
MicroblinkPlatformConfiguration(
    engine = EngineConfiguration(
        service = ServiceSettings(
            sdkConfiguration = "...",
            retryPolicy = NetworkRetryPolicy(),
        ),
    ),
    resultListener = resultListener,
    ui = UiConfiguration(
        colorScheme = colorScheme,
        typography = MicroblinkPlatformTypography.default(),
        scannerTypography = ScannerTypography(),
        images = MicroblinkPlatformImages(),
        buttonShape = CircleShape,
    ),
    cardScanResultListener = cardScanResultListener,
)
```

</TabItem>
</Tabs>

`MicroblinkPlatformConfig` is renamed to `MicroblinkPlatformConfiguration`, and its fields lose the `mbp` prefix:

- `mbpServiceSettings` is replaced by `engine`.
- `mbpResultListener` is renamed to `resultListener`.
- `mbpUiSettings` is renamed to `ui`.
- `mbpCardScanResultListener` is renamed to `cardScanResultListener`.

### Service settings

`MicroblinkPlatformServiceSettings` is replaced by `EngineConfiguration(service = ServiceSettings(sdkConfiguration))`.
Here's what happened to each of its fields:

- `workflowId` is removed.
  Your backend sets the workflow when it creates the transaction.
- `proxySettings` is removed, together with `MicroblinkPlatformProxySettings` and its URL, custom paths, and `additionalRequestHeaders`.
  The SDK talks to the Platform directly.
- `consent` is removed, together with `MicroblinkPlatformConsent`.
  Collect the consent in your app before the verification starts; your backend sends it when it creates the transaction.
  The SDK's consent dialog is removed as well, so any overrides of its `mbp_consent_dialog_*` string resources no longer have an effect.
- `correlationId` is removed.
  Your backend sends it when it creates the transaction, in the `correlationId` field of `POST /api/v2/transaction`.
- `ServiceSettings` has a new optional `retryPolicy`, which controls how often the SDK retries a failed or busy request.
  The default, `NetworkRetryPolicy(maxAttempts = 5, retryDelayMillis = 500)`, is a good fit for most apps.

### UI settings

`MicroblinkPlatformUiSettings` is renamed to `UiConfiguration`, with these changes:

- `colorScheme` is unchanged, but its `primary`, `onPrimary`, `surface`, and `onSurface` colors now also color the document scanning, card scanning, and face capture screens.
- `typography` still takes a `MicroblinkPlatformTypography`, but its fields have changed.
  Instead of v1's field for each screen (`homeTitle`, `errorTitle`, and so on), it has a field for each kind of text, such as `heading`, `description`, `fieldBody`, and `button`.
  See the KDoc of `MicroblinkPlatformTypography`, or [Fonts](./customization.md#fonts), for which style goes where.
  To keep our default sizes and only change the font, use `MicroblinkPlatformTypography.default(fontFamily = yourFontFamily)`.
- `mbpImages` is renamed to `images`.
  `MicroblinkPlatformImages` is unchanged.
- `buttonShape` takes a `Shape` directly, instead of a `ButtonShape` wrapper.
  It now applies to every button on our screens, including those in dialogs.
- `documentScanningTypography` is replaced by `scannerTypography`, which takes a `ScannerTypography`.
  It sets the fonts of the document scanning, card scanning, and face capture screens; read [Scanning screens](./customization.md#scanning-screens).

## Results

`MicroblinkPlatformResultListener` has a new method, `onVerificationFailed(transactionId, error)`, which you must implement.
It's called when the verification ends with an error that the user can't retry, after they close the error screen.
`transactionId` is `null` if the verification couldn't start at all.

Exactly one of the three methods is called for each verification, on the main thread, after the user leaves our screens.
The other two methods take new types:

- `onVerificationFinished` receives a `SessionOutcome.Verification` instead of a `MicroblinkPlatformResult`.
  It has the same `transactionId` and `state` fields; `state` is now a `VerificationState` (`Accept`, `Reject`, or `Review`).
- `onVerificationCanceled` receives a `SessionOutcome.Canceled` instead of a `MicroblinkPlatformCancelState`.
  `cancelReason` is renamed to `reason`, and the `ConsentDenied` reason is removed, because the SDK no longer handles consent.
  `transactionId` is no longer nullable.

If you use `MicroblinkPlatformCardScanResultListener`:

- `onCardScanned` still receives a `CardScanResult`, but its `expiryDate` is now a `CardDate` instead of a `Date`, with the same `day`, `month`, and `year` fields.
- It's called at most once for each verification, as soon as the Platform accepts the card.
  The result is complete, but its `toString()` hides most of the card number, the owner, and the CVV, so that logging it doesn't leak the card.

## Lifecycle

- `startVerification` now throws an `IllegalStateException` if a verification is already running.
- If the app's process is killed during a verification, the verification can't continue.
  Create a new transaction and start over.
- The SDK uses AndroidX App Startup to track which activity is in front, and starts automatically.
  If your app turns off App Startup's automatic initialization, or runs the verification in a separate process, initialize the SDK in `Application.onCreate` instead, before any activity starts:

  ```kotlin
  AppInitializer.getInstance(this).initializeComponent(EngineInitializer::class.java)
  ```


Last updated on Nov 26, 2026
