Get Started With Scandit ID Capture#

Quick overview#

ID Capture provides the capability to scan personal identification documents, such as identity cards, passports or visas. In this guide you will learn step by step how to add ID Capture to your application. Roughly, the steps are:


Using ID Capture with other modes (e.g. Barcode Capture or Text Capture) is not supported.


Before starting with adding a capture mode, make sure that you have a valid Scandit Data Capture SDK license key and that you added the necessary dependencies. If you have not done that yet, check out this guide.


You can retrieve your Scandit Data Capture SDK license key, by signing in to your account at

Please note that your license may support only a subset of ID Capture features. If you would like to use additional features please contact us at

Create the Data Capture Context#

The first step to add barcode capture capabilities to your application is to create a new data capture context. The context expects a valid Scandit Data Capture SDK license key during construction.

DataCaptureContext dataCaptureContext = DataCaptureContext.forLicenseKey("-- ENTER YOUR SCANDIT LICENSE KEY HERE --");

Adding the Camera#

You need to also create Camera:

camera = Camera.getDefaultCamera(IdCapture.createRecommendedCameraSettings());

if (camera == null) {
    throw new IllegalStateException("Failed to init camera!");


Adding the Data Capture View#

Next, in order to actually see the camera feed on the screen, create an instance of DataCaptureView and add it to your view hierarchy. For example:

DataCaptureView view = DataCaptureView.newInstance(this, dataCaptureContext);
rootView.addView(view, new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));

Create ID Capture Settings#

Use IdCaptureSettings to configure the types of documents that you’d like to scan. Check IdDocumentType for all the available options.

IdCaptureSettings settings = new IdCaptureSettings();

Implementing the Listener#

To receive scan results, implement IdCaptureListener. A result is delivered as CapturedId. This class contains data common for all kinds of personal identification documents. For more specific information use its non-null result properties (for example CapturedId.aamvaBarcode).

class MyListener implements IdCaptureListener {
    public void onIdCaptured(
            @NotNull IdCapture mode,
            @NotNull IdCaptureSession session,
            @NotNull FrameData data
    ) {
        CapturedId capturedId = session.getNewlyCapturedId();

        // The recognized fields of the captured Id can vary based on the type.
        if (capturedId.getMrz() != null) {
            // Handle the information extracted.
        } else if (capturedId.getViz() != null) {
            // Handle the information extracted.
        } else if (capturedId.getAamvaBarcode() != null) {
            // Handle the information extracted.
        } else if (capturedId.getUsUniformedServicesBarcode() != null) {
            // Handle the information extracted.

    public void onErrorEncountered(
            @NotNull IdCapture mode,
            @NotNull Throwable error,
            @NotNull IdCaptureSession session,
            @NotNull FrameData data
    ) {
      // Handle the error

Create a new ID Capture mode with the chosen settings. Then register the listener:

idCapture = IdCapture.forDataCaptureContext(dataCaptureContext, settings);

The last thing that needs to be done is enabling the mode and turning on the camera:


And this is it. You can now scan documents.

Supported documents#

You can find the list of supported documents here.

What’s next?

To dive further into the Scandit Data Capture SDK we recommend the following articles: