Overview
The Onfido Android SDK provides a drop-in set of screens and tools for Android applications to capture identity documents and selfie photos, videos and motion captures for the purpose of identity verification.
It offers a number of benefits to help you create the best identity verification experience for your customers:
- Carefully designed UI to guide your customers through the entire photo, video or motion capture process
- Modular design to help you seamlessly integrate the photo, video or motion capture process into your application flow
- Advanced image quality detection technology to ensure the quality of the captured images meets the requirement of the Onfido identity verification process, guaranteeing the best success rate
- Direct image upload to the Onfido service, to simplify integration
Note: The SDK is only responsible for capturing and uploading photos, videos and motion captures. You still need to access the Onfido API to manage applicants and perform checks.
Getting started
The SDK supports API level 21 and above (distribution stats).
Version 7.4.0 was the last version that supported API level 16 and above.
Our configuration is currently set to the following:
minSdkVersion = 21
targetSdkVersion = 31
android.useAndroidX=true
Kotlin = 1.7.10+
compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }
The following content assumes you're using our API v3 versions for backend calls. If you are currently using API v2 please refer to this migration guide for more information.
ℹ️
If you are integrating using Onfido Studio please see our** Studio integration guide
1. Obtain an API token
In order to start integrating, you will need an API token.
You can use our sandbox environment to test your integration. To use the sandbox, you'll need to generate a sandbox API token in your Onfido Dashboard.
Note: You must never use API tokens in the frontend of your application or malicious users could discover them in your source code. You should only use them on your server.
1.1 Regions
Onfido offers region-specific environments. Refer to the Regions section in our API documentation for token format and API base URL information.
2.1 onfido-capture-sdk
This is the recommended integrated option.
This is a complete solution, focusing on input quality. It features advanced on-device, real-time glare and blur detection as well as auto-capture (passport only) on top of a set of basic image validations.
repositories { mavenCentral() } dependencies { implementation 'com.onfido.sdk.capture:onfido-capture-sdk:x.y.z' }
Due to the advanced validation support (in C++ code) we recommend that the integrator app performs multi-APK split to optimize the app size for individual architectures.
2.1.1 Multi-APK split
C++ code needs to be compiled for each of the CPU architectures (known as "ABIs") present on the Android environment. Currently, the SDK supports the following ABIs:
armeabi-v7a
: Version 7 or higher of the ARM processor. Most recent Android phones use thisarm64-v8a
: 64-bit ARM processors. Found on new generation devicesx86
: Most tablets and emulatorsx86_64
: Used by 64-bit tablets
The SDK binary contains a copy of the native .so
file for each of these four platforms.
You can considerably reduce the size of your .apk
by applying APK split by ABI, editing your build.gradle
to the following:
android { splits { abi { enable true reset() include 'x86', 'x86_64', 'arm64-v8a', 'armeabi-v7a' universalApk false } } }
Read the Android documentation for more information.
Average size (with Proguard enabled):
ABI | Size |
---|---|
armeabi-v7a | 11.62 Mb |
arm64-v8a | 11.42 Mb |
2.2 onfido-capture-sdk-core
This is a lighter version. It provides a set of basic image validations, mostly completed on the backend. There are no real-time validations on-device so ABI split is not needed.
repositories { mavenCentral() } dependencies { implementation 'com.onfido.sdk.capture:onfido-capture-sdk-core:x.y.z' }
Average size (with Proguard enabled):
ABI | Size |
---|---|
universal | 8.51 Mb |
Note: The average sizes were measured by building the minimum possible wrappers around our SDK, using the following stack. Different versions of the dependencies, such as Gradle or NDK, may result in slightly different values.
In order to improve the security of our clients, we upgraded our infrastructure and SDK client SSL configurations to support TLSv1.2 only. According to the relevant Google documentation, this support comes enabled by default on every device running Android API 20+. If you need to support older devices, we need to access Google Play Services to install the latest security updates which enable this support. If you don't use Google Play Services on your integration yet, we require you to add the following dependency:
compile ('com.google.android.gms:play-services-base:x.y.z') { exclude group: 'com.android.support' // to avoid conflicts with your current support library }
3. Create an applicant
To create an applicant from your backend server, make a request to the 'create applicant' endpoint, using a valid API token.
Note: Different report types have different minimum requirements for applicant data. For a Document or Facial Similarity report the minimum applicant details required are first_name
and last_name
.
$ curl https://api.onfido.com/v3/applicants \ -H 'Authorization: Token token=<YOUR_API_TOKEN>' \ -d 'first_name=John' \ -d 'last_name=Smith'
The JSON response will return an id
field containing a UUID that identifies the applicant. Once you pass the applicant ID to the SDK, documents, photos, videos and motion captures uploaded by that instance of the SDK will be associated with that applicant.
4. Configure the SDK with a token
You'll need to generate and include an SDK token every time you initialize the SDK. To generate an SDK token, make a request to the 'generate SDK token' endpoint.
$ curl https://api.onfido.com/v3/sdk_token \ -H 'Authorization: Token token=<YOUR_API_TOKEN>' \ -F 'applicant_id=<YOUR_APPLICANT_ID>' \ -F 'application_id=<YOUR_APPLICATION_ID>'
Parameter | Notes |
---|---|
applicant_id | required Specifies the applicant for the SDK instance. |
application_id | required The application ID that was set up during development. For Android, this is usually in the form com.example.yourapp . Make sure to use a valid application_id or you'll receive a 401 error. |
SDK tokens expire after 90 minutes.
4.1 tokenExpirationHandler
You can use the optional tokenExpirationHandler
parameter in the SDK token configurator function to generate and pass a new SDK token when it expires. This ensures the SDK continues its flow even after an SDK token has expired. You should inject a new token in 10 seconds after the callback is triggered, else flow will finish with TokenExpiredException
error.
For example:
Kotlin
class ExpirationHandler : TokenExpirationHandler { override fun refreshToken(injectNewToken: (String?) -> Unit) { TODO("<Your network request logic to retrieve SDK token goes here>") injectNewToken("<NEW_SDK_TOKEN>") // if you pass `null` the sdk will exit with token expired error } } val config = OnfidoConfig.builder(context) .withSDKToken("<YOUR_SDK_TOKEN_HERE>", tokenExpirationHandler = ExpirationHandler()) // ExpirationHandler is optional
Java
class ExpirationHandler implements TokenExpirationHandler { @Override public void refreshToken(@NotNull Function1<? super String, Unit> injectNewToken) { //Your network request logic to retrieve SDK token goes here injectNewToken.invoke("<NEW_SDK_TOKEN>"); // if you pass `null` the sdk will exit with token expired error } } OnfidoConfig.Builder config = new OnfidoConfig.Builder(context) .withSDKToken("<YOUR_SDK_TOKEN>", new ExpirationHandler()); // ExpirationHandler is optional
6. Custom Application Class
Note: You can skip this step if you don't have any custom application class.
After the release of version 17.0.0, Onfido Android SDK runs in a separate process. This means that when the Onfido SDK started, a new application instance will be created. To prevent reinitializing you have in the Android application class, you can use the isOnfidoProcess
extension function and return from onCreate
as shown below:
This will prevent initialization-related crashes such as: FirebaseApp is not initialized in this process
Handling callbacks
To receive the result from the flow, you should override the method onActivityResult
on your Activity or Fragment. Typically, on success, you would create a check on your backend server.
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { ... onfido.handleActivityResult(resultCode, data, new Onfido.OnfidoResultListener() { @Override public void userCompleted(Captures captures) { } @Override public void userExited(ExitCode exitCode) { } @Override public void onError(OnfidoException exception) { } }); }
Attribute | Notes |
---|---|
userCompleted | User completed the flow. You can now create a check on your backend server. The captures object contains information about the document and face captures made during the flow. |
userExited | User left the SDK flow without completing it. Some images may have already been uploaded. The exitCode object contains information about the reason for exit. |
onError | Some error happened. |
captures
Sample of a captures
instance returned by a flow with FlowStep.CAPTURE_DOCUMENT
, FlowStep.CAPTURE_FACE
and FlowStep.PROOF_OF_ADDRESS
:
Document: Front: DocumentSide(id=document_id, side=FRONT, type=DRIVING_LICENCE, nfcSupported=false) Back: DocumentSide(id=document_id, side=BACK, type=DRIVING_LICENCE, nfcSupported=false) Type: DRIVING_LICENCE Face: Face(id=face_id, variant=PHOTO) Proof of address: Poa(id=poa_id, type=UTILITY_BILL, issuing_country=UK)
Note: type
property refers to DocumentType
, variant refers to FaceCaptureVariant
Note: As part of userCompleted
method, the DocumentType
property can only contain the values which are supported by Onfido API. Please check out our API documentation
exitCode
Potential exitCode
reasons:
exitCode |
---|
USER_LEFT_ACTIVITY |
USER_CONSENT_DENIED |
CAMERA_PERMISSION_DENIED (Deprecated) |
Customizing the SDK
You can also read our SDK customization guide.
Flow customization
You can customize the flow of the SDK via the withCustomFlow(FlowStep[])
method. You can remove, add and shift around steps of the SDK flow.
final FlowStep[] defaultStepsWithWelcomeScreen = new FlowStep[]{ FlowStep.WELCOME, //Welcome step with a step summary, optional FlowStep.CAPTURE_DOCUMENT, //Document capture step FlowStep.CAPTURE_FACE, //Face capture step FlowStep.PROOF_OF_ADDRESS, //Proof of address capture step FlowStep.FINAL //Final screen step, optional }; final OnfidoConfig config = OnfidoConfig.builder() .withCustomFlow(defaultStepsWithWelcomeScreen) .withSDKToken("<YOUR_SDK_TOKEN>") .build();
Exiting the flow
You can call the exitWhenSentToBackground()
method of the OnfidoConfig.Builder
, to automatically exit the flow if the user sends the app to background.
This exit action will invoke the userExited(ExitCode exitCode)
callback.
Consent step
This step contains a screen to collect US end users' privacy consent for Onfido. It contains the consent language required when you offer your service to US users as well as links to Onfido's policies and terms of use. This is an optional screen.
The user must click "Accept" to move past this step and continue with the flow. The content is available in English only, and is not translatable.
This step doesn't automatically inform Onfido that the user has given their consent. At the end of the SDK flow, you still need to set the API parameter privacy_notices_read_consent_given
outside of the SDK flow when creating a check.
If you choose to disable this step, you must incorporate the required consent language and links to Onfido's policies and terms of use into your own application's flow before your end user starts interacting with the Onfido SDK.
For more information about this step, and how to collect user consent, please visit Onfido Privacy Notices and Consent.
Document capture step
In the Document Capture step, an end user can select the issuing country and document type before capture. In a very limited number of cases, the end user may also be asked if they have a card or paper version of their document.
This information is used to optimize the capture experience, as well as inform the end user about which documents they are allowed to use.
This selection screen is optional, and will be automatically hidden where the end user is not required to indicate which document will be captured.
You can specify allowed issuing countries and document types for the document capture step in one of three ways:
- If you are using Onfido Studio, this is configured within a Document Capture task, documented in the Studio Product Guide
- Otherwise, for Onfido Classic you can set this globally in your Dashboard (recommended), or hard code it into your SDK integration. Both of these options are documented below.
Country and document type selection by Dashboard
Configuring the issuing country and document type selection step using your Dashboard is the recommended method of integration (available from iOS SDK version 28.0.0 and Android SDK version 16.0.0 onwards) as this configuration is also applied to your Document Reports. Any document that has been uploaded by an end user against your guidance will result in a Document Report sub-result of "rejected" and be flagged as Image Integrity
> Supported Document
.
We will be rolling out Dashboard-based configuration of allowed documents soon. In the meantime, contact support@onfido.com or your Customer Support Manager to request access to this feature.
- Open the Accounts tab on your Dashboard, then click Supported Documents
- You will be presented with a list of all available countries and their associated supported documents. Make your selection, then click Save Change.
Please note the following SDK behaviour:
- Hard coding any document type and issuing country configuration in your SDK integration will fully override the Dashboard-based settings
- Currently, only passport, national ID card, driving licence and residence permit are visible for document selection by the end user in the SDK. For the time being, if you nominate other document types in your Dashboard (visa, for example), these will not be displayed in the user interface
- If you need to add other document types to the document selection screen, you can mitigate this limitation in the near-term, using the Custom Document feature
- If for any reason the configuration fails or is not enabled, the SDK will fallback to display the selection screen for the complete list of documents supported within the selection screens
Country and document type customization by SDK integration code
You can configure the document step to capture single document types with specific properties, as well as customize the screen to display only a limited list of document types using the DocumentCaptureStepBuilder
class's functions for the corresponding document types.
Document Type | Configuration function | Configurable Properties |
---|---|---|
Passport | forPassport() | |
National Identity Card | forNationalIdentity() | - country - documentFormat |
Driving Licence | forDrivingLicence() | - country - documentFormat |
Residence Permit | forResidencePermit() | - country |
Visa | forVisa() | - country |
Work Permit | forWorkPermit() | - country |
Generic | forGenericDocument() | - country - documentPages |
Note GENERIC
document type doesn't offer an optimised capture experience for a desired document type.
- Document type
The list of document types visible for the user to select can be shown or hidden using this option. If only one document type is specified, users will not see the selection screen and will be taken directly to the capture screen. Please see a more detailed guide here.
Each document type has its own configuration class.
Customizing the issuing country and document type selection screen with pre-selected documents
You can also customize the screen to display only a limited list of document types, using the configuration function to specify the ones you want to show.
Currently you can only include PASSPORT
, NATIONAL_IDENTITY_CARD
, DRIVING_LICENCE
, RESIDENCE_PERMIT
in the list.
For example, to hide the Driving Licence Document type:
Kotlin
val documentTypes = listOf( DocumentType.PASSPORT, DocumentType.NATIONAL_IDENTITY_CARD, DocumentType.RESIDENCE_PERMIT ) onfidoConfigBuilder.withAllowedDocumentTypes(documentTypes)
- Document country
The configuration function allows you to specify the document's country of origin. If a document country is specified for a document type, the selection screen is displayed with preselected country.
Note: You can specify country for all document types except PASSPORT
. This is because passports have the same format worldwide so the SDK does not require this additional information.
For example to only capture UK driving licences:
Kotlin
val drivingLicenceCaptureStep = DocumentCaptureStepBuilder.forDrivingLicence() .withCountry(CountryCode.GB) .build()
- Document format
You can specify the format of a document as CARD
or FOLDED
. CARD
is the default document format value for all document types.
If FOLDED
is configured a specific template overlay is shown to the user during document capture.
Note: You can specify FOLDED
document format for French driving licence, South African national identity and Italian national identity only. If you configure the SDK with an unsupported
document format the SDK will throw a InvalidDocumentFormatAndCountryCombinationException
.
For example to only capture folded French driving licences:
Kotlin
val drivingLicenceCaptureStep = DocumentCaptureStepBuilder.forDrivingLicence() .withCountry(CountryCode.FR) .withDocumentFormat(DocumentFormat.FOLDED) .build()
Not all document - country combinations are supported. Unsupported documents will not be verified. If you decide to bypass the default country selection screen by replacing the FlowStep.CAPTURE_DOCUMENT
with a CaptureScreenStep
, please make sure that you are specifying a supported document.
We provide an up-to-date list of our supported documents.
Face capture step
In this step a user can use the front camera to capture their face in the form of photo, video or motion capture.
The Face step has 3 variants:
- To configure for photo use
FlowStep.CAPTURE_FACE
orFaceCaptureStepBuilder.forPhoto()
. - To configure for video use
FaceCaptureStepBuilder.forVideo()
. - To configure for motion use
FaceCaptureStepBuilder.forMotion()
.
Motion
The Motion variant may not be supported on certain devices due to device capabilities and/or Google Play Services availability along with MLKit Face Detection module.
If the Motion variant is not supported on the user’s device, you can configure the SDK to allow the user to capture a Selfie or a Video instead by using the withCaptureFallback
function.
The following examples show how to configure the Motion variant with a Photo capture fallback and a Video capture fallback.
FlowStep faceCaptureStep = FaceCaptureStepBuilder.forMotion() .withCaptureFallback( FaceCaptureStepBuilder.forPhoto() .withIntro(showIntro) ) .build(); FlowStep faceCaptureStep = FaceCaptureStepBuilder.forMotion() .withCaptureFallback( FaceCaptureStepBuilder.forVideo() .withIntro(showIntro) ) .build();
Please note that if no fallback is configured and Motion is not supported on the user device the flow will end with an OnfidoException
resulting in an onError
callback.
Motion supports audio recording, but it is disabled by default. In order to enable it use .withAudio(true)
.
FlowStep faceCaptureStep = FaceCaptureStepBuilder.forMotion() .withAudio(true) .build();
Introduction screen
By default both face and video variants show an introduction screen. This is an optional screen. You can disable it using the withIntro(false)
function.
Customization of introduction screen for motion variant is not available.
FlowStep faceCaptureStep = FaceCaptureStepBuilder.forVideo() .withIntro(false) .build();
Confirmation screen
By default both face and video variants show a confirmation screen. To not display the recorded video on the confirmation screen, you can hide it using the withConfirmationVideoPreview
function.
FlowStep faceCaptureStep = FaceCaptureStepBuilder.forVideo() .withConfirmationVideoPreview(false) .build();
Errors
The Face step can be configured to allow only for one variant. A custom flow cannot contain multiple variants of the face capture. If more than one type of FaceCaptureStep
are added to the same custom flow, a custom IllegalArgumentException
will be thrown at the beginning of the flow,
with the message "You are not allowed to define more than one FaceCaptureVariant in a flow."
.
NFC capture
Recent passports, national identity cards and residence permits contain a chip that can be accessed using Near Field Communication (NFC). The Onfido SDKs provide a set of screens and functionalities to extract this information, verify its authenticity and provide the results as part of a Document report. With version [18.1.0] of the Onfido Android SDK, NFC is enabled by default and offered to customer when both the document and the device support NFC.
For more information on how to configure NFC and the list of supported documents, please refer to the NFC for Document Report guide.
Disabling NFC and excluding dependencies
As NFC is enabled by default and library dependencies are included in the build automatically, the following section details the steps required to disable NFC and remove any libraries from the build process:
Call disableNFC()
while configuring OnfidoConfig
:
val config = OnfidoConfig.builder(this@MainActivity) .withSDKToken(“<YOUR_SDK_TOKEN_HERE>”) .disableNFC() //Disable NFC feature .withCustomFlow(flowSteps) .build()
Exclude dependencies required for NFC from your build:
dependencies { implementation 'com.onfido.sdk.capture:onfido-capture-sdk:x.y.z' { exclude group: 'net.sf.scuba', module: 'scuba-sc-android' exclude group: 'org.jmrtd', module: 'jmrtd' exclude group: 'com.madgag.spongycastle', module: 'prov' } }
UI customization
For visualizations of the available options please see our SDK customization guide.
Dark theme
Starting from version 19.1.0, Onfido SDK supports the dark theme. By default, the user's active device theme will be automatically applied to the Onfido SDK. However, you can opt out from dynamic theme switching at run time and instead set a theme statically at the build time as shown below. In this case, the flow will always be in displayed in the selected theme regardless of the user's device theme.
To force select dark theme:
onfidoConfigBuilder.withTheme(OnfidoTheme.DARK)
To force select light theme:
onfidoConfigBuilder.withTheme(OnfidoTheme.LIGHT)
Appearance and Colors
You can customize colors and other appearance attributes by overriding Onfido themes (OnfidoActivityTheme
and OnfidoDarkTheme
) in your themes.xml
or styles.xml
.
Make sure to set OnfidoBaseActivityTheme
as the parent of OnfidoActivityTheme
and OnfidoBaseDarkTheme
as the parent of OnfidoDarkTheme
in your style definition.
All colors referenced in the themes should be defined in your colors.xml
. Alternatively, you can use hexadecimal
color values directly in the themes. When customising fonts, all referenced fonts must be added to your project first.
Further instructions for adding fonts can be found
here.
For instance, you can add these themes to your themes.xml
to change the toolbar background and primary buttons'
color:
<!-- Light theme --> <style name="OnfidoActivityTheme" parent="OnfidoBaseActivityTheme"> <item name="onfidoColorToolbarBackground">@color/brand_dark_blue</item> <item name="onfidoColorActionMain">@color/brand_accent_color</item> </style> <!-- Dark theme --> <style name="OnfidoDarkTheme" parent="OnfidoBaseDarkTheme"> <item name="onfidoColorToolbarBackground">@color/brand_dark_blue</item> <item name="onfidoColorActionMain">@color/brand_accent_color</item> </style>
The following attributes are currently supported:
- Colors
- General
onfidoColorBackground
: Background color of the non-capture screenscolorAccent
: Defines alert dialogs' accent color, and text input fields' focused underline, cursor, and floating label color
- Content
onfidoColorContentMain
: Color of primary texts on screen, e.g. titles and regular body textsonfidoColorContentMainDark
: Color of the content on capture screens (those with dark backgrounds)onfidoColorContentSecondary
: Color of secondary texts on screen, e.g. subtitlesonfidoColorContentNegative
: Color of error texts
- Main buttons
onfidoColorActionMain
: Background color of primary buttonsonfidoColorActionMainPressed
: Background color of primary buttons when pressedonfidoColorActionMainDisabled
: Background color of primary buttons when disabledonfidoColorContentOnAction
: Text color of primary buttonsonfidoColorContentOnActionDisabled
: Text color of primary buttons when disabled
- Secondary buttons
onfidoColorActionSecondary
: Background color of secondary buttonsonfidoColorActionSecondaryPressed
: Background color of secondary buttons when pressedonfidoColorActionSecondaryDisabled
: Background color of secondary buttons when disabledonfidoColorContentOnActionSecondary
: Text color of secondary buttonsonfidoColorContentOnActionSecondaryDisabled
: Text color of secondary buttons when disabledonfidoColorActionSecondaryBorder
: Border of the secondary buttonsonfidoColorActionSecondaryBorderDisabled
: Border of the secondary buttons when disabled
- Disclaimers
onfidoColorDisclaimerBackground
: Background color of disclaimer boxesonfidoColorContentDisclaimer
: Text color of disclaimer boxesonfidoColorIconDisclaimer
: Icon color of disclaimer boxes
- Toolbar and status bar
onfidoColorToolbarBackground
: Background color of theToolbar
which guides the user through the flowcolorPrimaryDark
: Color of the status bar (with system icons) above theToolbar
onfidoColorContentToolbarTitle
: Color of theToolbar
's title text
- Icons
onfidoColorIconStroke
: Stroke color of iconsonfidoColorIconStrokeNegative
: Stroke color for error iconsonfidoColorIconFill
: Fill color of iconsonfidoColorIconBackground
: Background color of iconsonfidoColorIconAccent
: Background color of accented iconsonfidoColorWatermark
: Color of the Onfido logo and co-brand logo in the footer of screensonfidoColorWatermarkDark
: Color of the Onfido logo and co-brand logo in the footer of capture screens
- Spinner / progress indicator
onfidoColorProgressTrack
: Track color of progress indicators (background color)onfidoColorProgressIndicator
: Indicator color of progress indicators (foreground color)
- General
Typography
You can customize the fonts by providing font XML resources to the theme by setting OnfidoActivityTheme
to one of the following:
onfidoFontFamilyTitleAttr
: Defines thefontFamily
attribute that is used for text which has typography typeTitle
onfidoFontFamilyBodyAttr
: Defines thefontFamily
attribute that is used for text which has typography typeBody
onfidoFontFamilySubtitleAttr
: Defines thefontFamily
attribute that is used for text which has typography typeSubtitle
onfidoFontFamilyButtonAttr
: Defines thefontFamily
attribute that is applied to all primary and secondary buttonsonfidoFontFamilyToolbarTitleAttr
: Defines thefontFamily
attribute that is applied to the title and subtitle displayed inside theToolbar
*onfidoFontFamilyDialogButtonAttr
: Defines thefontFamily
attribute that is applied to the buttons insideAlertDialog
andBottomSheetDialog
For example:
In your application's styles.xml
:
<style name="OnfidoActivityTheme" parent="OnfidoBaseActivityTheme"> <item name="onfidoFontFamilyTitle">@font/montserrat_semibold</item> <item name="onfidoFontFamilyBody">@font/font_montserrat</item> <!-- You can also make the dialog buttons follow another fontFamily like a regular button --> <item name="onfidoFontFamilyDialogButton">?onfidoFontFamilyButton</item> <item name="onfidoFontFamilySubtitle">@font/font_montserrat</item> <item name="onfidoFontFamilyButton">@font/font_montserrat</item> <item name="onfidoFontFamilyToolbarTitle">@font/font_montserrat_semibold</item> </style>
Localization
The SDK supports and maintains the following 44 languages:
- Arabic: ar
- Armenian: hy
- Bulgarian: bg
- Chinese (Simplified): zh_rCN
- Chinese (Traditional): zh_rTW
- Croatian: hr
- Czech: cs
- Danish: da🇰
- Dutch: nl🇱
- English (United Kingdom): en_rGB
- English (United States): en_rUS
- Estonian: et
- Finnish: fi
- French (Canadian): fr_rCA
- French: fr
- German: de
- Greek: el
- Hebrew: iw
- Hindi: hi
- Hungarian: hu
- Indonesian: in
- Italian: it
- Japanese: ja
- Korean: ko
- Latvian: lv
- Lithuanian: lt
- Malay: ms
- Norwegian bokmål: nb
- Norwegian nynorsk: nn
- Persian: fa
- Polish: pl
- Portuguese (Brazil): pt_rBR
- Portuguese: pt
- Romanian: ro
- Russian: ru
- Serbian: sr
- Slovak: sk
- Slovenian: sl
- Spanish (Latin America): es_rUS
- Spanish: es
- Swedish: sv
- Thai: th
- Turkish: tr
- Ukrainian: uk
- Vietnamese: vi
Custom language
The Android SDK also allows for the selection of a specific custom language for locales that Onfido does not currently support. You can have an additional XML strings file inside your resources folder for the desired locale (for example, res/values-it/onfido_strings.xml
for 🇮🇹 translation), with the content of our strings.xml file, translated for that locale.
When adding custom translations, please make sure you add the whole set of keys we have on strings.xml.
By default, we infer the language to use from the device settings. However, you can also use the withLocale(Locale)
method of the OnfidoConfig.Builder
to select a specific language.
Note: If the strings translations change it will result in a minor version change. If you have custom translations you're responsible for testing your translated layout.
If you want a locale translated you can get in touch with us at android-sdk@onfido.com.
Introduction
Onfido provides the possibility to integrate with our Smart Capture SDK, without the requirement of using this data only through the Onfido API. Media callbacks enable you to control the end user data collected by the SDK after the end user has submitted their captured media. As a result, you can leverage Onfido’s advanced on-device technology, including image quality validations, while still being able to handle end users’ data directly. This unlocks additional use cases, including compliance requirements and multi-vendor configurations, that require this additional flexibility. This feature must be enabled for your account. Please contact your Onfido Solution Engineer or Customer Success Manager.
Java
onfidoConfigBuilder.withMediaCallback(new CustomMediaCallback()); private static class CustomMediaCallback implements MediaCallback { @Override public void onMediaCaptured(@NonNull MediaResult result) { if (result instanceof DocumentResult) { // Your callback code here } else if (result instanceof LivenessResult) { // Your callback code here } else if (result instanceof SelfieResult) { // Your callback code here } } }
User data
The callbacks return an object including the information that the SDK normally sends directly to Onfido. The callbacks are invoked when the end user confirms submission of their image through the SDK’s user interface. Note: Currently, end user data will still automatically be sent to the Onfido backend. You are not required to use Onfido to process this data.
Documents
For documents the callback returns a DocumentResult
object:
{ fileData: MediaFile documentMetadata: DocumentMetadata }
The DocumentMetadata
object contains the metadata of the captured document.
{ side: String, type: String, issuingCountry: String }
⚠️ Note: issuingCountry
is optional based on end-user selection, and can be null
⚠️ Note: If a document was scanned using NFC, the callback will only return the MediaFile
.
Live photos and videos
For live photos the callback returns a SelfieResult
object:
{ fileData: MediaFile }
For live videos the callback returns a LivenessResult
object:
{ fileData: MediaFile }
The MediaFile
object contains the raw data, and file type and the file name of the captured photo or video.
{ fileData: ByteArray, fileType: String, fileName: String }
Create a check with Onfido
After receiving the user data from the SDK, you can choose to create a check with Onfido. In this case, you don’t need to re-upload the end user data as it is sent automatically from the SDK to the Onfido backend.
Please see our API documentation for more information on how to create a check.
Creating checks
The SDK is responsible for the capture of identity documents and selfie photos, videos and motion captures. It doesn't perform any checks against the Onfido API. You need to access the Onfido API in order to manage applicants and perform checks.
For a walkthrough of how to create a check with a Document and Facial Similarity report using the Android SDK read our Mobile SDK Quick Start guide.
Read our API documentation for further details on how to create a check with the Onfido API.
Note: If you're testing with a sandbox token, please be aware that the results are pre-determined. You can learn more about sandbox responses.
Note: If you're using API v2, please refer to the API v2 to v3 migration guide for more information.
Setting up webhooks
Reports may not return results straightaway. You can set up webhooks to be notified upon completion of a check or report, or both.
Overriding the hook
In order to expose a user's progress through the SDK, a hook method must be overridden using OnfidoConfig.Builder
. You can do this when initializing the Onfido SDK. For example:
Java:
// Place your listener in a separate class file or make it a static class class OnfidoEventListener implements OnfidoAnalyticsEventListener { private final Context applicationContext; private final Storage storage; OnfidoEventListener(Context applicationContext, Storage storage) { this.applicationContext = applicationContext; this.storage = storage; } @Override public void onEvent(@NonNull OnfidoAnalyticsEvent event) { // Your tracking or persistence code // You can persist the events to storage and track them once the SDK flow is completed or exited with an error // This appraoch can help to scope your potential network calls to the licecycle of your activity or fragment // storage.addToList("onfidoEvents", event); } } private static final int ONFIDO_FLOW_REQUEST_CODE = 100; OnfidoConfig onfidoConfig = OnfidoConfig.builder(applicationContext) .withAnalyticsEventListener(new OnfidoEventListener(applicationContext, storage)) .build(); Onfido.startActivityForResult(this, ONFIDO_FLOW_REQUEST_CODE, onfidoConfig);
Kotlin:
// Place your listener in a separate class file class OnfidoEventListener( private val applicationContext: Context, private val storage: Storage ) : OnfidoAnalyticsEventListener { override fun onEvent(event: OnfidoAnalyticsEvent) { // Your tracking or persistence code // You can persist the events to storage and track them once the SDK flow is completed or exited with an error // This appraoch can help to scope your potential network calls to the licecycle of your activity or fragment // storage.addToList("onfidoEvents", event) } } companion object { private const val ONFIDO_FLOW_REQUEST_CODE = 100 } val onfidoConfig = OnfidoConfig.builder(applicationContext) .withAnalyticsEventListener(new OnfidoEventListener(applicationContext, storage)) .build() Onfido.startActivityForResult(this, ONFIDO_FLOW_REQUEST_CODE, onfidoConfig)
The code inside the overridden method will now be called when a particular event is triggered, usually when the user reaches a new screen. Please use a static or separate class instead of a lambda or an anonymous inner class to avoid leaking the outer class, e.g. Activity or Fragment. Also refrain from using Activity or Fragment context references in your listener to prevent memory leaks and crashes. If you need access to a context object, you can inject your application context in the constructor of your listener as shown in the above example. As a better appraoch, you can wrap your application context in a single-responsibility class (such as Storage
or APIService
) and inject it in your listener, as shown in the example.
Notes:
UserEventHandler
is deprecated now, if you are upgrading from a previous Onfido SDK version, please migrate toOnfidoAnalyticsEventListener
and remove you existing listener (Onfido.userEventHandler
) otherwise you will get duplicated events (from both the legacy event handler and the new event listener).- ⚠️ From version 18.0.0 onwards, for any usage of the
OnfidoEventListener
, implementParcelable
instead ofSerializable
.
For a full list of events see TRACKED_EVENTS.md.
property | description |
---|---|
type | OnfidoAnalyticsEventType Indicates the type of event. Potential values (enum instances) are FLOW , SCREEN , ACTION , ERROR . |
properties | Map<OnfidoAnalyticsPropertyKey, String?> Contains details of an event. For example, you can get the name of the visited screen using the SCREEN_NAME property. The current potential property keys are: SCREEN_NAME , SCREEN_MODE , DOCUMENT_TYPE , COUNTRY_CODE , VIDEO_CHALLENGE_TYPE , IS_AUTOCAPTURE . |
Going live
Once you are happy with your integration and are ready to go live, please contact Client Support to obtain a live API token. You'll have to replace the sandbox tokens in your code with live tokens.
Check the following before you go live:
- you have set up webhooks to receive live events
- you have entered correct billing details inside your Onfido Dashboard
Cross platform frameworks
We provide integration guides and sample applications to help customers integrate the Onfido Android SDK with applications built using the following cross-platform frameworks:
We don't have out-of-the-box packages for such integrations yet, but these projects show complete examples of how our Android SDK can be successfully integrated in projects targeting these frameworks. Any issues or questions about the existing integrations should be raised on the corresponding repository and questions about further integrations should be sent to android-sdk@onfido.com.
Migrating
You can find the migration guide in the MIGRATION.md file.
Certificate Pinning
You can pin any communication between our SDK and server through the .withCertificatePinning()
method in
our OnfidoConfig.Builder
configuration builder. This method accepts as a parameter an Array<String>
with sha-1/sha-256 hashes of the certificate's public keys.
For more information about the hashes, please email android-sdk@onfido.com.
Accessibility
The Onfido Android SDK has been optimised to provide the following accessibility support by default:
- Screen reader support: accessible labels for textual and non-textual elements available to aid TalkBack navigation, including dynamic alerts
- Dynamic font size support: all elements scale automatically according to the device's font size setting
- Sufficient color contrast: default colors have been tested to meet the recommended level of contrast
- Sufficient touch target size: all interactive elements have been designed to meet the recommended touch target size
Refer to our accessibility statement for more details.
Licensing
Due to API design constraints, and to avoid possible conflicts during the integration, we bundle some of our 3rd party dependencies as repackaged versions of the original libraries.
For those, we include the licensing information inside our .aar
, namely on the res/raw/onfido_licenses.json
.
This file contains a summary of our bundled dependencies and all the licensing information required, including links to the relevant license texts contained in the same folder.
Integrators of our library are then responsible for keeping this information along with their integrations.
Sample App
We have included a sample app to show how to integrate the Onfido SDK.
API Documentation
Further information about the Onfido API is available in our API reference.
Support
Please open an issue through GitHub. Please be as detailed as you can. Remember not to submit your token in the issue. Also check the closed issues to see whether it has been previously raised and answered.
If you have any issues that contain sensitive information please send us an email with the ISSUE:
at the start of the subject to android-sdk@onfido.com.
Previous version of the SDK will be supported for a month after a new major version release. Note that when the support period has expired for an SDK version, no bug fixes will be provided, but the SDK will keep functioning (until further notice).
Copyright 2018 Onfido, Ltd. All rights reserved.
Change Log
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
Note: If the strings translations change it will result in a MINOR version change, therefore you are responsible for testing your translated layout in case you are using custom translations. More on language localisation
Added
- Introduced
withTheme(theme)
which enables you to either force set a dark/light theme, or follow the device’s system setting. More details can be found here - Added theme selection to Onfido SDK's public APIs
Fixed
- Fixed last two countries in the countries list are not visible
- Fixed the BadTokenException crashes that occurred when users moved the app to the background while capturing
- Fixed the crash occurs when decoding bitmap
- Fixed the Fatal 6 signal error after the document capture
- Fixed
IllegalArgumentException
crash occurring during image cropping operations - Fixed 'CameraDevice was already closed' crashes, occurring when leaving the camera screen right after opening it
- Fixed infinite loop issue on document capture with Redmi phones
Added
- Payload signing for Selfie and Liveness 1.0 (aka Video)
- Updated Consent screen. Disabled Accept and Reject buttons until the consent is read
- Added
inOnfidoProcess
extension function to the Application class to prevent reinitialization in the custom application classes. More info here
Changed
- Remove
Parcelable
implementation fromOnfidoAnalyticsEventListener
and run it in the same process with the application. - Remove
Parcelable
implementation fromTokenExpirationHandler
and run it in the same process with the application. - Remove
Parcelable
implementation fromMediaCallback
and run it in the same process with the application - Deprecated
withNFCReadFeature()
inOnfidoConfig
- Enabled NFC by default in
OnfidoConfig
. AddeddisableNFC()
for disabling it - Remove Document Liveness deprecated feature
- Update supported locals in public documentation
- Update OpenCV library version to 4.7.0
- Add all translations to github public documentation
Fixed
- Fixed a crash on foldable devices upon finishing Video/Liveness recording
- Fixed undefined 'onfidoFontFamilyBody' attribute in 'OnfidoBaseActivityTheme' by adding a default value
- Fixed the custom language selection issue
- Fixed weird toolbar icon that appears in loading and consent screens
- Reverted orientation mode to portrait mode
Added
- After the release of version 17.0.0, Onfido Android SDK runs in a separate process. This means that when the callback is triggered, the body of that callback will run in Onfido SDK process rather than the main application process. Therefore, any actions performed in the callback, such as accessing memory or modifying UI, will be executed within the SDK process. It is important to keep this in mind when designing and implementing callbacks in order to ensure the proper functioning and performance of the SDK. - After the release of version 17.0.0, Onfido Android SDK runs in a separate process. This means that when the callback is triggered, the body of that callback will run in the Onfido SDK process rather than the main application process. Therefore, any actions performed in the callback, such as accessing memory or modifying UI, will be executed within the SDK process. It is important to keep this in mind when designing and implementing callbacks in order to ensure the proper functioning and performance of the SDK. Having Onfido SDK run in its own process adds extra reliability to customer applications as it avoids crashes on the customer app. It also brings better error logging support.
- Add explicit support for the Nynorsk language
Changed
- Handle audio and mic conflicts if there is audio playing or if the mic is in use when we start recording
- Added translations for audio in Motion strings
- Updated MLKit Face Detection library
- Added a MLKit Face Detection Module check in addition to the Google Play Services check in order to fallback to Selfie/Video
- Updated the supported document file to include Honduras National ID
Changed
- Removed depreceated UserEventHandler. Please use OnfidoConfig.builder(context).withAnalyticsEventListener().
- Improve picture frame selection algorithm
- Added user analytics listener to WorkflowConfig builder. Similar to the normal flow, you can now attach your analytics listener to your config using WorkflowConfig.builder(context).withAnalyticsEventListener(listener).
Changed
- Implemented a new enhanced resolution selection algorithm to take document photos with a better resolution.
- Improved camera focus. Our camera implementation now waits for the camera to focus before taking the document photo to prevent having blurry photos.
- Fixed displaying photo captured feedback too early. This issue was misguiding users so that they were moving their document or their device away while the photo capture was in progress.
- Increased image compression quality parameter.
- Disabled photo cropping for foldable devices to prevent having improperly cropped document images.
Changed
- Implemented a new enhanced resolution selection algorithm to take document photos with a better resolution.
- Improved camera focus. Our camera implementation now waits for the camera to focus before taking the document photo to prevent having blurry photos.
- Fixed displaying photo captured feedback too early. This issue was misguiding users so that they were moving their document or their device away while the photo capture was in progress.
- Increased image compression quality parameter.
- Disabled photo cropping for foldable devices to prevent having improperly cropped document images.
Changed
- Implemented a new enhanced resolution selection algorithm to take document photos with a better resolution.
- Improved camera focus. Our camera implementation now waits for the camera to focus before taking the document photo to prevent having blurry photos.
- Fixed displaying photo captured feedback too early. This issue was misguiding users so that they were moving their document or their device away while the photo capture was in progress.
- Increased image compression quality parameter.
- Disabled photo cropping for foldable devices to prevent having improperly cropped document images.
[15.0.0] - 2022-12-16
Note: This version contains breaking changes and is not backwards-compatible. Migration notes can be found in MIGRATION.md
Fixed
- Fixed
ClassCastException
when Camera not found - Fixed an issue where the capture screen seems frozen after the app is sent to background and resumed
- Fixed the IllegalStateException crash, which occurs during navigation
- Fixed the NPE crash, which occurs during stopping the camera recording
- Fixed the crash when MLKit models cannot be downloaded. If this is the case we now detect this, and skip the validation.
- Fixed a bug where the capture button is displayed on top of the confirmation screen buttons
- Fixed Exif data related crashes
Fixed
- Fixed Exif data related crashes
- Fixed the IllegalStateException crash, which occurs during navigation
- Fixed the NPE crash, which occurs during stopping the camera recording
- Fixed the crash when MLKit models cannot be downloaded. If this is the case we now detect this, and skip the validation.
- Fixed
ClassCastException
when Camera not found
Changed
- Combined country and document type selection in one single screen (country first, document type second)
- Updated supported documents (Zambia NIC added, Albania Residence Permits removed, others)
- Introduced a new analytics event listener and deprecated the legacy UserEventHandler
- Disabled some functionalities that require Google Play Service when Google Play Service is unavailable
Changed
- Removed the option to implement the user consent screen directly in your configuration during SDK initialization. It is now controlled by the Onfido backend. Please see our Onfido privacy notices and consent migration guide for further information.
Changed
- Improved auto-capture performance
- Added
withNFCReadBetaFeature()
toOnfidoConfig.Builder
for enabling NFC - Removed traces of old support library references
- Marked extension functions as internal to avoid polluting integrators' namespace
- Onfido SDK now is built using Android Gradle Plugin 7.0.3
- Added NFC integration documentation
Fixed
- UI: Fixed issue that liveness digit challenge does not have delay before button appears
- Fixed crash issue -
NullPointerException: volumeView
must not benull
- UI: Fixed issue that
exitWhenSentToBackground
exits flow when it switches from front of document to back of document - Excluded META-INF/com.google.dagger_dagger.version from being packaged inside Onfido SDK
- Made microphone feature optional
Changed
- Added
MissingOnfidoConfigException
error message ifOnfidoConfig
is not specified when starting the flow - Applied new watermark position at the bottom of all screens
- Upgraded Kotlin version to v1.5.21
- Changed analytic event for passport from DOCUMENT_CAPTURE_FRONT to DOCUMENT_CAPTURE
- UI: Made live and post-capture alerts align to the top of the frame
- Implemented disabling mobile SDK analytics as an enterprise feature
- Migrated from RxJava 2 to RxJava 3
- Upgraded to AppCompat version 1.3.1
- Enabled R8
Changed
- UI: Split head turn instructions into 2 lines, with the arrow in between
- UI: Integrated image quality service
- UI: Improved designs and copies across the SDK. Please visit our MIGRATION.md for the copy updates
- Removed deprecated methods and constructors of DocumentType class
- UI: Removed timer icon from subtitle in welcome screen
- UI: Properly set titles as accessibility headings
- Live capture warnings like "Glare detected" shouldn't steal focus from the user's current selection during Voice Over or Accessibility mode
- UI: Existing strings have been updated and new ones have been added. For more information, please visit our MIGRATION.md
- UI: Screen reader should read back button with screen title
- UI: Made country selection list items to be treated as buttons
Fixed
- Fixed low image quality issue that was happening on certain Xiaomi devices
- Fixed disappearing passport capture instruction text during on device validations
- Fixed a bug that was not triggering VIDEO_FACIAL_CAPTURE_STEP_0, VIDEO_FACIAL_CAPTURE_STEP_1 events in UserEventHandler during face liveness flow
Changed
- Added
MissingOnfidoConfigException
error message ifOnfidoConfig
is not specified when starting the flow - Applied new watermark position at the bottom of all screens
- Upgraded Kotlin version to v1.5.21
- Changed analytic event for passport from DOCUMENT_CAPTURE_FRONT to DOCUMENT_CAPTURE
- UI: Made live and post-capture alerts align to the top of the frame
- Implemented disabling mobile SDK analytics as an enterprise feature
- Migrated from RxJava 2 to RxJava 3
- Upgraded to AppCompat version 1.3.1
- Enabled R8
Changed
- UI: Split head turn instructions into 2 lines, with the arrow in between
- UI: Integrated image quality service
- UI: Improved designs and copies across the SDK. Please visit our MIGRATION.md for the copy updates
- Removed deprecated methods and constructors of DocumentType class
- UI: Removed timer icon from subtitle in welcome screen
- UI: Properly set titles as accessibility headings
- Live capture warnings like "Glare detected" shouldn't steal focus from the user's current selection during Voice Over or Accessibility mode
- UI: Existing strings have been updated and new ones have been added. For more information, please visit our MIGRATION.md
- UI: Screen reader should read back button with screen title
- UI: Made country selection list items to be treated as buttons
Fixed
- Fixed low image quality issue that was happening on certain Xiaomi devices
- Fixed disappearing passport capture instruction text during on device validations
- Fixed a bug that was not triggering VIDEO_FACIAL_CAPTURE_STEP_0, VIDEO_FACIAL_CAPTURE_STEP_1 events in UserEventHandler during face liveness flow
Added
- Added an option to hide the recorded video on the confirmation screen. For more information, please visit our README
Changed
- Renamed most of the localisation keys. Now, names are more explicit in which screens they are being used. Please visit our MIGRATION.md
- Remove duplication in the README file
Changed:
- UI: Changed Onfido watermark design
- UI: Realtime glare detection is disabled for the backside of Romanian national identity card
- UI: Updated auto-capture manual fallback alert
- Internal: Migrated to AndroidX. For more information, please visit our MIGRATION.md
- Internal: Bump OkHttp version to 3.12.12 to avoid potential Android 11 issues
Changed:
- Now using API v3 for communication with the backend
- Internal: Extended basic device information logging to all relevant API requests
Fixed:
- UI: Fixed document template overlay and edge detection message overlapping issue
- UI: Fixed a bug that caused the
no face found
warning to not display on the selfie capture screen - Fixed localization problems on liveness instructions
- Fixed supported folded document types explanation on README
- Fixed a bug that threw
InvalidDocumentFormatAndCountryCombinationException
onNationalIdentityCaptureStepBuilder
andDrivingLicenceCaptureStepBuilder
when configured with country code and document format except CountryCode.FR and CountryCode.IT - Fixed a bug that was causing sending not supported document type property to the Onfido backend.
Added:
- Added
Fragment
support to be able to start the SDK using aFragment
instance - Added integrator defined event hook to allow integrators to collect user analytics
- Added
DocumentCaptureStepBuilder
andFaceCaptureStepBuilder
to createFlowStep
in order to customise SDK flow. For more information, please visit our README.md - UI: Now showing error message when passport MRZ is cut off in captured image
Changed:
- Updated code snippets and descriptions related to API V3 in README
- Changed 'mobile sdk token' expression with 'mobile token' in README to prevent confusion
- Updated full and core SDK implementation code snippets in README
- Internal: Updated the following network libraries on
onfido-api-client
:com.squareup.retrofit2:retrofit:2.1.0 -> com.squareup.retrofit2:retrofit:2.6.4
com.squareup.okhttp3:okhttp:3.3.0 -> com.squareup.okhttp3:okhttp:3.12.8
com.jakewharton.retrofit:retrofit2-rxjava2-adapter-> io.reactivex.rxjava2:rxandroid:2.1.1
- UI: Now using grey Onfido logo with higher contrast for accessibility
- UI: Screen reader order has been changed for better accessibility
- UI: Document guide overlay will be kept on the screen for longer
Deprecated:
- The
CaptureScreenStep
class deprecated. For more information, please visit our MIGRATION.md - The
FaceCaptureStep
class deprecated. For more information, please visit our MIGRATION.md
Added:
Face
property added intoCaptures
class- Added
sample-app
directory, in order to show sample usage of the sdk - UI: Added folded document template for French driving license and Italian identity document
- UI: Updated README.md to clarify mobile token usage
Added:
DocumentType.GENERIC
type added. For more information, please visit our README.md
Changed:
- UI: Updated README to clarify
APPLICATION_ID
term and how to obtain sandbox token - UI: Manual capture button showed after the user click retake or back button for passport and US DL
- UI: For passports and US Driving Licenses (DL) the manual capture button is shown after the user clicks on retake or on the back button.
- UI: The manual fallback countdown changed
- Internal: Changed token expiration identifier for the
onfido-api-client
Added:
- Added SDK token support for US region
- Added ability to refresh SDK token when it expired. For more information, please visit our [README.md](https://github.com/onfido/onfido-android-sdk/blob/19.2.1/README.md#4.1 SDK Token)
- Internal: Basic device information started to logging
Removed
- Removed the
withUSDLAutocapture()
method from theOnfidoConfig.Builder
. The autocapture of the United States' driving license is now enabled by default - Removed applicant creation using the SDK, along with the
withApplicant(Applicant)
method of theOnfidoConfig.Builder
. The applicant should always from now on be created outside of the SDK and its id used to initialise the flowwithApplicant(String)
on theOnfidoConfig.Builder
[4.11.1] - 2019-11-07
Note Changes in this version are the changes applied on v5.0.1 to 4.11.0
Added:
- Internal: Support new token format
- Added certificate pinning support. For more information, please visit our README.md
Added:
- Added the ability to skip the selfie intro screen by adding the
FaceCaptureVariantPhoto
that can be passed as an argument to aFaceCaptureStep
- Added the ability for integrators to specify a
Locale
for the flow to be displayed with, instead of inferring it from the device settings - Added the ability for integrators to enable an "exit when sent to background" mode in the SDK flow through the
exitWhenSentToBackground()
in theOnfidoConfig.Builder
. This mode enforces that the flow will automatically exit through theuserExited()
callback whenever the app is sent to background mid-flow - Added support for preselection of work permit documents, through the
DocumentType.WORK_PERMIT
enum value. This is a beta feature
Fixed:
- Fixed crash when initialising the capture screen and system returned a null camera to the SDK
- Fixed crash in the liveness confirmation screen, related with the usage of a vector drawable as the background of a button
- Fixed a crash when initialising the capture screen and we are not able to retrieve the camera parameters from the system
- Fixed crash happening when the activity
android:label
property is required to be non-blank
Fixed:
- Fixed crash when the SDK was wrongly doing operations with unknown request codes when transitioning from the capture screen to the flow screen
- Fixed crash when the SDK tries to access a view after the app was sent to background
- Fixed a crash when uploading the liveness video when the filename contains characters not supported by OkHttp
- Fixed a crash happening when face detection or tracking started on a device/emulator without Play Services
- Fixed a crash when reporting an error during the video recording back to the user while the error callback is
null
- Fixed crash when checking for front camera support for selfie/video purposes throws a
RuntimeException
- UI: Fixed the issue of text getting cropped when going over 2 lines in bullet views. The text can now go up to 3 lines and shows an ellipsis if the content is longer than that.
Added:
- Added the ability to preselect just a document type, without specifying any info about the country of origin nor ask the user to select it
- UI: Added video review feature after live video recording
- UI: Added face detection and automatic recording on liveness capture
- UI: Added live face tracking during liveness challenges recording
Changed:
- UI: Revamped liveness control buttons to provide a more explicit and easy to follow flow
- Internal: Simplified analytics by removing lifecycle-aware events
- Internal: Improved the repackaging method for our 3rd party dependencies
- Internal: Updated the map for the supported countries for each document
Added:
- Added the ability to customise action buttons and icons colors
- Added instructions for integrators to get notified about releases
- UI: Added permission request and recovery screens for camera and microphone permissions
- Internal: Now bundling Proguard rules with the SDK, removing the need for the host application to specify those rules for themselves
Changed:
- UI: Revamped flow final screen
- UI: Revamped the flat action button according to a new, more accessible design specification
- UI: Revamped liveness control buttons to provide a more explicit and easy to follow flow
- Internal: Changed our analytics solution from an external provider to an in-house service
Fixed:
- Fixed a crash happening when the host app forces a support library version below ours
27.1.0
- UI: Fixed a bug which allowed users to dismiss the bottom sheet on the country selection screen
- UI: Fixed a bug of misalignment of video capture instructions happening when a longer than usual custom translation is provided
- UI: Fixed a bug which caused a crop on the document validation bubble when non-regular font sizes are set
Fixed
- Fixed bug which caused an unexpected behaviour when pressing back during a preselected document as first flow step
- Fixed bug causing a crash when an unexpected error body is returned from the API
- UI: Fixed bug during autocapture causing the information bottom sheet to enter an inconsistent state whenever the app was sent to background after the manual fallback threshold was triggered
Added
- Added post capture barcode detection for United States driving license captures
- Added
strings.xml
as a public file, in order to enable custom localisation. More information can be found in our README.md - Added out-of-the-box Portuguese (
pt
) translation
[4.0.0] - 2018-04-23
Note: This version contains breaking changes and is not backwards-compatible. Migration notes can be found in MIGRATION.md
[3.0.0] - 2018-04-05
Note: This version contains breaking changes and is not backwards-compatible. Migration notes can be found in MIGRATION.md
Added
- UI: Added post capture blur detection for every document type
- UI: Added zoom & pan feature for document and face on confirmation screen
- Added cross platform frameworks section in README.md
- Added support for Singaporean residence permits as identity documents
- Added
onError(OnfidoException exception, Applicant applicant)
callback on theOnfido
interface, used to track flow completion
Changed
- UI: Changed confirmation screen layout and buttons
- UI: Refactored colours across UI elements on the whole flow.
- Internal: Upgraded API client to make use of enhanced document detection feature on backend
- Internal: Restricted support for TLS 1.2 only on every network call, improving communication security
Fixed
- Internal: Fixed crash on returning from the capture screen to the country list and to the document selection right after
- Internal: Fixed crash occasionally happening when closing the camera view (https://github.com/onfido/onfido-android-sdk/issues/12)
- Internal: Fixed crash when requesting focus repeatedly on capture screen
- Internal: Fixed crash occasionally happening when opening the camera view (https://github.com/onfido/onfido-android-sdk/issues/10)
- Internal: Fixed crash occasionally happening when starting the camera preview (https://github.com/onfido/onfido-android-sdk/issues/11)
- Internal: Fixed crash occasionally happening when the host app background process is killed while the SDK was running (https://github.com/onfido/onfido-android-sdk/issues/9)
[2.0.0]
Note: This version contains breaking changes and is not backwards-compatible. Migration notes can be found in MIGRATION.md
Added
- Added
FaceCaptureStep(FaceCaptureVariant variant)
, which is a custom object to add a face capture step to the flow, with a variant of eitherFaceCaptureVariant.PHOTO
orFaceCaptureVariant.VIDEO
. Currently, the previousFlowStep.CAPTURE_FACE
is still available and is equivalent tonew FaceCaptureStep(FaceCaptureVariant.PHOTO)
- UI: Added new video face capture screen as an alternative to photo face capture screen
- Permissions: We now require the
android.permission.RECORD_AUDIO
permission, in order to capture audio from video Face captures - UI: Added Spanish translation
[1.0.0]
Note: This version contains breaking changes and is not backwards-compatible. Migration notes can be found in MIGRATION.md
Changed
Deprecated
MESSAGE_IDENTIFY_VERIFICATION
FlowStep
, since it is too specific for the purpose of the SDK, which should stay as generic as possibleChanged the default flow, accessible through
FlowStep.getDefaultFlow()
to include a welcome step, also accessible asFlowStep.WELCOME
Document capture step, accessible through
FlowStep.CAPTURE_DOCUMENT
now features 3 different screens. First, a document type selection screen is shown, followed by a country selection screen for the document origin country to be chosen. Finally, the camera screen for the document captureRedesign of the message screen which results from a
MessageScreenStep
Internal:
FlowStep.WELCOME
andFlowStep.MESSAGE_FACE_VERIFICATION
now have a bullet points layout with new copyInternal: Added a toolbar as part of the flow UI, with a title describing the current step and the ability to return to the previous step
Internal: Added bottom sheet on Country Selection screen showing instructions for when the user can not find the origin country of his/her document
Internal: Updated Kotlin version to
1.1.1
Fixed
- Internal: Crash on NullPointerException when trying to upload document which came as
null
from the camera. Anull
check is now performed after the picture is taken, and an error message is shown in case it isnull
- Internal: If country and document type selected is India and national id card, only the front of the document will be asked of the user. There was a mistake where this behaviour was happening with the driver's license instead.
Removed
- Removed
FlowStep.MESSAGE
step. Developers should add aMessageScreenStep(String title, String subtitle, String nextButtonText)
to a custom flow instead, specifying which information they want to show on the screen. - Internal: Removed unused
.png
drawables - Internal: Removed unneeded
theme
from the<application>
tag, which could cause conflicts with the host app'stheme
Fixed
- Internal: Crash On RuntimeException for "Could not find requested camera". A message is now presented to the user in such cases, letting him know the camera is not available.
- Internal: Crash On RuntimeException for "takePicture failed". A message is now presented to the user when this happens.
- Internal: Crash on IllegalArgumentException for "meteringAreas is invalid NumFocusAreas must < 4". For devices that have a limit on the number of areas a safeguard clause was added to the code.
Added
- introduced allowMetrics, which allows the developer to choose whether SDK-only metrics may be taken.
- introduced CaptureScreenStep, which allows preselection of the document type on the flow configuration, hiding the document type selection view during the flow.
createIntent
was undeprecated, this is helpful when initiating the sdk from fragments.
Fixed
- Crash bug fixed when the user denies camera permission.
- Internal: Fixed crash bug caused when the main activity got recreated and its applicant became null, which caused exceptions.
- Internal: Fixed the crash problem when another appp is using the camera in the background and the user opens the capture step at the same time. This fix informs the user of the problem, in hope the user will correct the situation.
Added
- Internal: A confirmation step shows up before sending the photo for validation.
- Added both
withBaseUrl(String)
andwithToken(String)
, which allow to customize the base url used when communicating to the backend and the possibility to set the authorization token used when communicating with said back-end.
Fixed
- Removed the colorAccent resource, which was causing dialog buttons to disappear.
- Internal: Auto focus before capture has been removed, due to problems found on some devices.
- Internal: Fixed crash on devices without flash mode.
- Internal: Removed unused image assets.
- Internal: autoFocus crash bug exception fixed.
- Internal: Fixed null pointer exception crash when focus mode gets reverted in certain scenarios.
Added
startActivityForResult(Activity, int requestCode, OnfidoConfig)
andhandleActivityResult(int requestCode, int resultCode, Intent, OnfidoResultListener)
have both been added to simplify the callback process.createIntent(OnfidoConfig, int requestCode)
has been added to replacecreateIntent(OnfidoConfig config)
Removed
- The check is no longer initiated by the sdk.
extractCheckResult(Intent)
has been removedOnfidoConfig#withAsyncCheck(boolean)
andOnfido#withSyncWaitTime(int)
have been removed since they are related to check initiationFlowStep.SYNC_LOADING
has been removed as one of the possible steps.
- The deprecated
withCustomFlow(FlowAction[])
has been removed
Added
- Capture Screen: Continuous Focus Mode is now always active.
- Capture Screen: It's possible to trigger a manual auto focus cycle by tapping on the screen.
- Capture Screen: A manual auto focus cycle is triggered before taking a picture.
- Capture Screen: Added an exposure metering area equal to the rectangle that encompasses the overlay shape.
Fixed
- Capture Screen: Corrected the size and ratio of the camera preview and improved its resolution, notable effect on the face capture screen.
- Capture Screen: Removed copy that said an automatic capture would be triggered.
- Fixed a crash bug that happened whenever the user pressed back going from the face to the document capture screen in one go.
- Fixed a bug that did not permit the camera to be used by other apps when the sdk was running in the background.
Fixed
- Build: Gradle script now supports proper publishing
- UI: Date picker now has a max date
- UI: Date picker style is now consistent with the other input fields (First and last name)
- UI: Date format is now displayed according to the device regional settings
- UI: Fixed the zooming of the face capture, it's now properly centered
- UI: Fixed the button radius, changed it according to UI spec
19.0.0
-> 19.1.0
- Onfido SDK now supports the dark theme. By default, the user's active device theme will be
automatically applied to the Onfido SDK. However, you can opt out from dynamic theme switching at run time
and instead set a theme statically at the build time. In this case, the flow will always be in displayed
in the selected theme regardless of the user's device theme. Please refer to the dark theme section in
README.md
for further details on how to configure the SDK with a static UI theme. - Onfido's public colors defined in your
colors.xml
are now deprecated. Please refer to the "appearance and colors" section inREADME.md
for our new theme-based UI customization approach and the list of available attributes and UI customization options.
Breaking changes
- Remove
Parcelable
implementation fromMediaCallback
and run it in the same process with the application. - Remove
Parcelable
implementation fromOnfidoAnalyticsEventListener
and run it in the same process with the application. - Remove
Parcelable
implementation fromTokenExpirationHandler
and run it in the same process with the application.
Breaking changes
- Updated the properties of
MediaFile
(used for custom media callbacks) - it now contains 3 attributes: the file data, file type and file name - Dropped
Attr
suffix from font attribute names inOnfidoBaseActivityTheme
. - Removed the internal
onfidoFontFamily
attribute inOnfidoBaseActivityTheme
.
Breaking changes
- After the release of version 17.0.0, Onfido Android SDK runs in a separate process. This means that when the callback is triggered, the body of that callback will run in Onfido SDK process rather than the main application process. Therefore, any actions performed in the callback, such as accessing memory or modifying UI, will be executed within the SDK process. It is important to keep this in mind when designing and implementing callbacks in order to ensure the proper functioning and performance of the SDK.