Android WebView implementation guide

Prev Next

This guide explains how to integrate our verification flow into your Android application using WebViews.

Veriff support two WebView implementations, each with different use cases and requirements.

WebView Options

Chrome custom tabs

  • Provides a tab-based browser experience that maintains visual consistency with your app

  • Compatible only with the Redirect approach

  • Not compatible with InContext SDK (due to security concerns with JS injection)

WebView (recommended)

  • Embeds web content directly within your native app

  • Offers greater JavaScript control and customization

  • Required for InContext SDK

  • Recommended for most use cases


Required OS Permissions

Add these permissions to your AndroidManifest.xml before implementing the verification flow:

<uses-permission android:name="android.permission.INTERNET" />

<uses-permission android:name="android.permission.CAMERA" />

<uses-permission android:name="android.permission.RECORD_AUDIO" />

<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />

Note: The MODIFY_AUDIO_SETTINGS permission is required for proper microphone functionality in some Android devices, particularly when using Veriff’s flow in a WebView. If you do not need audio, and the audio_disabled flag is true, you do not need this permission setting.

You will also need to request these permissions at runtime for Android 6.0 (API level 23) and higher.


WebView configuration

The following settings are essential for proper WebView functionality in Veriff’s verification flow:

Key WebView settings

For your Android WebView, ensure you configure these critical settings:

// SETTING: Enable JavaScript
// WHAT IT DOES: Ensures JavaScript is enabled, which is required for the web application
// DOCS: https://developer.android.com/reference/android/webkit/WebSettings#setJavaScriptEnabled(boolean)
webView.settings.javaScriptEnabled = true

// SETTING: Enable DOM storage
// WHAT IT DOES: Allows the web application to use DOM storage APIs
// DOCS: https://developer.android.com/reference/android/webkit/WebSettings#setDomStorageEnabled(boolean)
webView.settings.domStorageEnabled = true
 
// SETTING: Disable user gesture requirement for media playback
// WHAT IT DOES: Critical for allowing camera access without user tap/interaction
// DOCS: https://developer.android.com/reference/android/webkit/WebSettings#setMediaPlaybackRequiresUserGesture(boolean)
webView.settings.mediaPlaybackRequiresUserGesture = false


Article versioning

Date

Description

May 15, 2025

Documentation published