Skip to content

Upgrading to v10.x

richardsimongreen edited this page Jul 25, 2024 · 1 revision

There have been a number of breaking changes in this 10.0.0 release. Please read through this section to understand those changes and refer to the revised README.md.

Changes to Packages

With v10.x, the API is now inside the package com.iproov.sdk.api (instead of com.iproov.sdk). This will require changes to import statements.

Changes to Sessions and Launchers

With v10.x, the new method of starting an iProov scan is to first create a Session and then call .start() on it.

Note that .start() may only be called once (even if it fails) otherwise a new exception SessionCannotBeStartedTwiceException will be thrown immediately.

This means that IProovFlowLauncher and IProovCallbackLauncher have been removed.

The Callback mechanism had been kept in previous major versions to ease the transition to StateFlows. Callbacks are inherently dangerous in these situations in the Android world and can lead to memory leaks.

Now the only way to listen to the states of IProov and to gain the result is to collect from Session.state: StateFlow<IProov.State> as follows:

val session = IProov.createSession(context, baseUrl, token, options)
launch {
    session.state.collect { state ->
        //TODO Action on State
    }
}
session.start()

Changes to States

IProov.State has a new initial state called IProov.State.Starting, which comes before IProov.State.Connecting.

Renamed Classes and Interfaces in IProov

"IProov" has been removed from many classes and interfaced within IProov itself to avoid unnecessary duplication.

e.g. IProov.IProovSessionState is now IProov.SessionState