Android SDK migration guide

Migrating Veriff Android SDK from 5.x.x to 6.0.0

SDK integration

The following APIs were removed:

  • Branding.Builder.themeColor(color) - split into two different attributes: Branding.Builder.primary(color) & Branding.Builder.secondary(color)

  • Branding.Builder.logomark(drawable)

  • Branding.Builder.primaryButtonBackgroundColor(color) - the button background will be set based on the new Branding.Builder.onPrimary(color) attribute

  • Branding.Builder.bulletPoint(color) - bullet point color can be controlled by the new Branding.Builder.secondary(color) & Branding.Builder.onSecondary(color) attributes

  • Branding.Builder.notificationIcon(color)

The following APIs were renamed:

  • Branding.Builder.toolbarIcon(drawable) renamed to Branding.Builder.logo(drawable)

  • Branding.Builder.backgroundColor(color) renamed to Branding.Builder.background(color)

  • Branding.Builder.primaryTextColor(color)renamed to Branding.Builder.onBackground(color)

  • Branding.Builder.secondaryTextColor(color) renamed to Branding.Builder.onBackgroundSecondary(color)

  • Branding.Builder.buttonCornerRadius(cornerRadius) renamed to Branding.Builder.buttonRadius(cornerRadius)

The following APIs were added:

  • Branding.Builder.onBackgroundTertiary(color)

  • Branding.Builder.primary(color)

  • Branding.Builder.onPrimary(color)

  • Branding.Builder.secondary(color)

  • Branding.Builder.onSecondary(color)

  • Branding.Builder.outline(color)

  • Branding.Builder.error(color)

  • Branding.Builder.success(color)

Migrating Veriff Android SDK from 4.x.x to 5.0.0

SDK integration

The following APIs were removed:

  • Branding.Builder.buttonHeight(height) - buttons are now always with a 60dp height

  • Branding.Builder.statusBarColor(color) - the status bar is now using the backgroundColor attribute instead

  • Branding.Builder.externalResources(externalResources) - resources can be customized via toolbarIconProvider(), toolbarIcon() and the new logomark() method

  • Font.Builder.setNormalAndBold(normal, bold) - this was split into separate setters for font weights

The following APIs were added:

  • Branding.Builder.logomark(drawable) - sets a drawable to use in UI elements where a square logo is needed. (Defaults to the Veriff logomark when this attribute is not set)

  • Font.Builder.setRegular(regularFont) - sets regular weight font

  • Font.Builder.setMedium(mediumFont) - sets medium weight font

  • Font.Builder.setBold(boldFont) - sets bold weight font

Migrating Veriff Android SDK from 3.x.x to 4.0.0

Follow these steps to migrate from SDK 3.x.x to 4.0.0

Android Gradle Plugin

Open the root build.gradle file and change the classpath dependency in the buldscript section if that is needed.

groovy buildscript { repositories { ... } dependencies { classpath 'com.android.tools.build:gradle:3.4.1' // and above ... } } - SHOW THIS AS CODE, GPT version below

buildscript {
    repositories { // Add your repositories here
        ...
    }
    dependencies {
        ...
        classpath 'com.android.tools.build:gradle:3.4.1' // and above
        ...
    }
}

Kotlin

Open the root build.gradle file and change the classpath dependency in the buldscript section if that needed.

buildscript {
    ext.kotlinVersion = '1.4.0' // and above
    repositories {
      ...
    }
    dependencies {
        ...
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
        ...
    }
}

Proguard

Open the root build.gradle file and add the force update to the buildscript section if that needed.

groovy buildscript { ... configurations.all { resolutionStrategy { force 'net.sf.proguard:proguard-gradle:6.2.2' } } }   - SHOW THIS AS CODE, GPT version below

buildscript {
    configurations.all {
        resolutionStrategy {
            force 'net.sf.proguard:proguard-gradle:6.2.2'
        }
    }
}

SDK integration

Nothing changed in SDK except the public API types.

Update the imports to:

  • java import com.veriff.Branding;

  • import com.veriff.Configuration;

  • import com.veriff.Font;

  • import com.veriff.Result;

  • import com.veriff.Sdk;

Change types:

  • from VeriffBranding to Branding

  • VeriffConfiguration to Configuration

  • VeriffFont to Font

  • VeriffResult to Result

Migrating Veriff Android SDK from 2.x.x to 3.0.0

Follow these steps to migrate from SDK 2.x.x to 3.0.0

Switch to AndroidX

Veriff SDK 3.0.0 requires AndroidX 1.0.0 or later. If you haven't switched to AndroidX in your app yet then follow this guide by Android.

Enable Java 8

Veriff SDK 3.0.0 requires Java 8 language features to be enabled in your project. If you do not have this enabled already, add this to your app/build.gradle file under the android {} section:

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

See more in an Android guide here.

Switch from baseUrl and sessionToken to sessionUrl

The new 3.0.0 SDK requires a single sessionUrl parameter instead of baseUrl and sessionToken. See the documentation here. As a backwards compatibility measure, if a sessionToken value is passed into the sessionUrl parameter then it will still work with an assumed baseUrl of magic.veriff.com.

Use com.veriff.* classes instead of mobi.lab.veriff.data.* ones

The name and location of the main SDK entry class has changed from mobi.lab.veriff.data.Veriff to com.veriff.VeriffSdk. The API is largely similar - instead of Veriff.Builder there's a VeriffSdk.createLaunchIntent method that returns an Intent which you can then use to launch veriff. See example here.

If you are using Branding to customize the look and feel of the SDK then it has a new name - VeriffBranding. The builder interface has been streamlined by removing the set* prefixes from all the methods. Read more about customization here.

Use com.veriff.VeriffResult instead of reading return Intent directly

Starting with 3.0.0 there's a new way to handle the result of the verification flow. Instead of reading INTENT_EXTRA_STATUS directly from the returned data intent, use VeriffResult.fromResultIntent(data) to get a result object with a status field and an optional error field. We've reduced status to just three - CANCELED, ERROR, DONE. In case of ERROR the error field contains more information. See the example here.

Remove usage of deprecated types

While the old SDK entry points are still present for backwards compatibility, they will be removed in the future. Please remove usage of any SDK type marked with @Deprecated. The easiest way to discover these is to look at your Gradle build log with Java/Kotlin compilation warnings turned on.

Here is a list of old deprecated classes due to be removed in a future release:

mobi.lab.veriff.data.Veriff
mobi.lab.veriff.data.Veriff.Builder
mobi.lab.veriff.data.VeriffConstants
mobi.lab.veriff.data.Branding
mobi.lab.veriff.data.Branding.Builder
mobi.lab.veriff.data.DrawableProvider
mobi.lab.veriff.util.LogAccess
mobi.lab.veriff.util.LogAccess.LogLevel
mobi.lab.veriff.util.LogcatLogAccess
mobi.lab.veriff.service.VeriffStatusUpdatesService