Please note that Microblink is no longer maintaining this repository.
As such, there will be no additional updates or releases for this codebase. You are welcome to continue using the code, as it remains source available.
Furthermore, if you need to update it for a newer SDK or platform version, you can do so by forking this repository and maintaining the fork independently.
If you have questions regarding such, please contact our support team at support@microblink.com.
This repository shows a basic proof of concept for running Microblink's Browser SDKs in a WebChromeClient so that it:
- Requests adequate permissions from the user in the native layer
- Loads the designated URL which should host one of Microblink's Browser SDKs
- Ensures permission requests from the browser are appropriately handled by the native layer
To deploy the sample application, simply clone the repository, update the webView.loadUrl and deploy it on your physical Android device.
The most important thing to note is that one has to request the proper permissions (in AndroidManifest.xml file):
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" android:required="true" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />Then, along with the usual permission handling on the Android level (see here), the same permissions requests need to be handled within the Webview object (code in MainActivity.kt):
if (request.resources.contains(PermissionRequest.RESOURCE_VIDEO_CAPTURE) ||
request.resources.contains(PermissionRequest.RESOURCE_AUDIO_CAPTURE) ) {
request.grant(request.resources)
}By ensuring the necessary permissions are incorporated into the Android Manifest and browser permission requests are appropriately replied by the native layer, Microblink's Browser SDKs can be easily accessed in a WebView context.
Hope this helps, and if you'll have any additional questions, please reach out to us and we'll be happy to help.