Capture Address(with Gallery)

Configuration

To use any Sybrin SDK you will need a Sybrin issued license. You can have a look at our licensing page to request one.

Using the license provided you will need to build and instance of the SybrinDocumentScannerConfiguration class that will help with configuring the SDKs' behavior.

For example:

SybrinDocumentScannerConfiguration sic = new SybrinDocumentScannerConfiguration
        .Builder(<sybrin_license_here>)
        .build();

To see the full range of configuration available please visit the SybrinDocumentScannerConfiguration page

Calling feature

To start scanning a document you will need to get an instance of the SybrinDocumentScanner class using the configuration built before. With this object you will be able to call the captureWithGallerymethod, which has a DocumentType as a parameter. Finally you can register for the 2 different callbacks right on the method call.

For example:

sybrinDocumentScannerConfiguration = new SybrinDocumentScannerConfiguration.Builder(SYB_LICENSE).build();
SybrinDocumentScanner sdc = SybrinDocumentScanner.getInstance(MainActivity.this, sybrinDocumentScannerConfiguration);

sdc.captureWithGallery(DocumentType.AddressDocument).addOnSuccessListener(this::onScanSuccess)
                    .addOnFailureListener(this::onScanFailure);

Subscribing to any of the callbacks on the captureWithCamera method is optional.

Handling callback responses

There are 2 different callbacks that can be subscribed to. They are as follows:

OnSuccessListener

When the SDK has completed the cropping process the result of that process will be posted to the OnSuccessListener.onSuccess callback. The DataModel that is returned is a parent class to all country specific classes.

For example:

sdc.captureWithGallery(DocumentType.AddressDocument).addOnSuccessListener(this::onScanSuccess)

OnFailureListener

When the SDK encounters an error an DocumenrScannerException is posted to the OnFailureListener.onFailure callback. The DocumentScannerException will contain all the needed information to help solve the issue causing the error.

For example:

sdc.captureWithGallery(DocumentType.AddressDocument).addOnFailureListener(this::onScanFailure)
private void onScanFailure(DocumentScannerException ie) { }

Last updated