NEWSMRZ Scanner is now part of barKoder.What it means for you →

DOCUMENTATION

Installation guide

MRZ Scanner 1.x (archive) / Android

Documentation / MRZ Scanner 1.x (archive) / Android

On this page

 

Using Gradle


1.Add the following line to your app's build.gradle:

implementation 'com.scansolutions.mrzscanner:mrzscannerlib:1.9.2'

 

 

Manual integration


1.Copy mrzscannerlib.aar in the libs/ folder

 

2.Add the following dependencies in your app’s build.gradle file:

  • implementation(name: 'mrzscannerlib', ext: 'aar')

 

3.Add this code in the root of you app’s build.gradle file to link the libs/ dir:

 

repositories {
    flatDir{
      dirs 'libs'
        }
    }

 

Implementation


1. Add the following code to the layout.xml of the activity where you want the scanner to be shown:

(Partial scanning view is also possible by positioning and resizing the scanner fragment)

 

    <fragment
     android:id="@+id/scannerFragment"
     android:name="com.scansolutions.mrzscannerlib.MRZScanner"
     android:layout_width="match_parent"
     android:layout_height="match_parent" />

 

2. Use this code to configure the scanner. The code should be added in the activity where the scanning will take place.

 

MRZScanner mrzScanner = (MRZScanner) getSupportFragmentManager().findFragmentById(R.id.scannerFragment);
mrzScanner.setScannerType(ScannerType.SCANNER_TYPE_MRZ); // Options: [SCANNER_TYPE_MRZ, SCANNER_TYPE_DOC_IMAGE_ID, SCANNER_TYPE_DOC_IMAGE_PASSPORT]
mrzScanner.setIDActive(true);          // Enable/disable the ID document type
mrzScanner.setPassportActive(true);    // Enable/disable the Passport document type
mrzScanner.setVisaActive(true);        // Enable/disable the Visa document type
mrzScanner.setMaxThreads(2);           // Set the max CPU threads that the scanner can use
mrzScanner.registerWithLicenseKey("licenseKey");
String sdkVersion = MRZScanner.sdkVersion(); // Get the current SDK version of MRZScanner

 

3. Implement the MRZScannerListener interface as a listener for a successful MRZ scan.

Java:
public class MainActivity extends AppCompatActivity implements MRZScannerListener { ...


Kotlin:
class MainActivity : AppCompatActivity(), MRZScannerListener { ...

 

Updated Jun 18, 2020 · Questions? Ask us