Skip to main content

Classic UI for the Android VIN Scanner Module

Overview

To learn how to integrate the VIN Scanner with Classic UI Components, take a look at the example app or follow the instructions below.

VinScanner can only be used in conjunction with ScanbotCameraXView for live detection with preview.

Adding the feature as a dependency and initializing the SDK

VinScanner is included in Scanbot SDK package 2. Therefore, add the dependency io.scanbot:sdk-package-2 or higher in your build.gradle along with the necessary assets:

implementation("io.scanbot:sdk-package-2:$latestSdkVersion")
implementation("io.scanbot:sdk-textpattern-assets:$latestSdkVersion")

The Scanbot SDK must be initialized before use. Add the following code snippet to your Application class:

Initialize SDK
loading...

Adding ScanbotCameraXView to the layout

<io.scanbot.sdk.ui.camera.ScanbotCameraXView
android:id="@+id/camera_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />

Getting the VinScanner instance from ScanbotSDK, and attaching it to ScanbotCameraXView

Attach Vin Scanner to ScanbotCameraXView
loading...

Adding a result handler for VinScannerFrameHandler:

Add a frame handler which observes successful recognition status and, for example, sets the scanned data to a properly formatted resultTextView.

Add a result handler for Vin Scanner Frame Handler
loading...

As the result of scanning, the user gets the VinScanResult class instance, which contains a raw scanned text, a recognition confidence value and a flag indicating that scanned value was successfully validated.

Using the finder overlay

It is important to add a finder overlay because of the scanner's underlying implementation. By doing so, the camera is directed to the VIN area and recognition is limited to only a small portion of the preview frame. This should greatly improve performance and accuracy of recognition.

Details about applying finder view logic in the layout and in the code can be found here.

Want to scan longer than one minute?

Generate a free trial license to test the Scanbot SDK thoroughly.

Get free trial license