BlinkInput Mobile SDK

Let your users seamlessly scan and extract IBANs, VINs, top-up vouchers, concert tickets and other data — directly in your smartphone app. Now complete with a new Document Capture feature. Need BlinkInput to scan something more specific? Let us know what it is and we’ll give our best to make it happen.

Go to BlinkInput product page

Integrating BlinkInput

BlinkInput is a lightweight mobile SDK you can integrate into native (iOS and Android) or cross-platform (React Native, Xamarin, Cordova) app. Documentation, size reports, code sample and integration guides are available on our Github repos. Please select yours below and keep in mind you’ll need to create an account on our Developer dashboard to generate a trial license key.

Integration sample codes

Copy to clipboard
/**
 * Set your license file. The recommended way is extending the Android Application class
 * and setting the license file in its onCreate callback.
 * Register on our dashboard to get the license key for your app.
 */
public class MyApplication extends Application {
    @Override
    public void onCreate() {
        MicroblinkSDK.setLicenseFile("path/to/license/file/within/assets/dir", this);
    }
}

public class MyActivity extends Activity {
    // list of all available parsers can be found here: https://bit.ly/2z6ZUSd
    private IbanParser mIbanParser;
    private AmountParser mAmountParser;

    private FieldByFieldBundle mFieldByFieldBundle;
    
    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        
        // setup views, as you would normally do in onCreate callback
        
        mIbanParser = new IbanParser();
        mAmountParser = new AmountParser();

        // prepare scan elements and put them in the FieldByFieldBundle
        // we need to scan 2 items, so we will create bundle with 2 elements
        mFieldByFieldBundle = new FieldByFieldBundle(
            // each scan element contains two string resource IDs: string shown in title bar
            // and string shown in text field above scan box. Besides that, it contains parser
            // that will extract data from the OCR result.
            new FieldByFieldElement(R.string.iban_title, R.string.iban_msg, mIbanParser),
            new FieldByFieldElement(R.string.amount_title, R.string.amount_msg, mAmountParser)
        );

    }
  
    public void startFieldByFieldScanning() {
        // Settings for FieldByFieldScanActivity activity
        FieldByFieldUISettings settings = new FieldByFieldUISettings(mFieldByFieldBundle);
    
        // tweak settings as you wish
    
        // Start activity
        ActivityRunner.startActivityForResult(this, MY_REQUEST_CODE, settings);
    }
  
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (requestCode == MY_REQUEST_CODE) {
            if (resultCode == FieldByFieldScanActivity.RESULT_OK && data != null) {
                // load the data into all elements bundled within your FieldByFieldBundle
                mFieldByFieldBundle.loadFromIntent(data);

                // now every parser object that was bundled within FieldByFieldBundle
                // has been updated with results obtained during the scanning session

                // you can get the results by invoking getResult on each parser, and then
                // invoke specific getter for each concrete parser result type
                String iban = mIbanParser.getResult().getIban();
                String amount = mAmountParser.getResult().getAmount();

                if (!iban.isEmpty()) {
                    // iban has been successfully parsed, you can use it however you wish
                }
                if (!amount.isEmpty()) {
                    // amount has been successfully parsed, you can use it however you wish
                }
            }
        }
    }

}
Copy to clipboard
class ViewController: UIViewController, MBBarcodeOverlayViewControllerDelegate  {
    
    var rawParser: MBRawParser?
    var parserGroupProcessor: MBParserGroupProcessor?
    var blinkInputRecognizer: MBBlinkInputRecognizer?

    override func viewDidLoad() {
        super.viewDidLoad()
    }

    @IBAction func didTapScan(_ sender: AnyObject) {
        
        let settings = MBBarcodeOverlaySettings()
        rawParser = MBRawParser()
        parserGroupProcessor = MBParserGroupProcessor(parsers: [rawParser!])
        blinkInputRecognizer = MBBlinkInputRecognizer(processors: [parserGroupProcessor!])
        
        let recognizerList = [self.blinkInputRecognizer!]
        let recognizerCollection : MBRecognizerCollection = MBRecognizerCollection(recognizers: recognizerList)
        
        /** Create your overlay view controller */
        let barcodeOverlayViewController : MBBarcodeOverlayViewController = MBBarcodeOverlayViewController(settings: settings, recognizerCollection: recognizerCollection, delegate: self)
        
        /** Create recognizer view controller with wanted overlay view controller */
        let recognizerRunneViewController : UIViewController = MBViewControllerFactory.recognizerRunnerViewController(withOverlayViewController: barcodeOverlayViewController)
        
        /** Present the recognizer runner view controller. You can use other presentation methods as well (instead of presentViewController) */
        present(recognizerRunnerViewController!, animated: true, completion: nil)
    }
  
  func barcodeOverlayViewControllerDidFinishScanning(_ barcodeOverlayViewController: MBBarcodeOverlayViewController, state: MBRecognizerResultState) {

    // this is done on background thread
    // check for valid state
    if state == MBRecognizerResultState.valid {

        // first, pause scanning until we process all the results
        barcodeOverlayViewController.recognizerRunnerViewController?.pauseScanning()

        DispatchQueue.main.async(execute: {() -> Void in
            // All UI interaction needs to be done on main thread
        })
    }
  }

  func barcodeOverlayViewControllerDidTapClose(_ barcodeOverlayViewController: MBBarcodeOverlayViewController) {
      // Your action on cancel 
  }
}
Copy to clipboard
@interface ViewController () <MBBarcodeOverlayViewControllerDelegate>

@property (nonatomic, strong) MBRawParser *rawParser;
@property (nonatomic, strong) MBParserGroupProcessor *parserGroupProcessor;
@property (nonatomic, strong) MBBlinkInputRecognizer *blinkInputRecognizer;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
}


- (IBAction)didTapScan:(id)sender {
    
    MBBarcodeOverlaySettings* settings = [[MBBarcodeOverlaySettings alloc] init];

    self.rawParser = [[MBRawParser alloc] init];
    self.parserGroupProcessor = [[MBParserGroupProcessor alloc] initWithParsers:@[self.rawParser]];
    self.blinkInputRecognizer = [[MBBlinkInputRecognizer alloc] initWithProcessors:@[self.parserGroupProcessor]];

    /** Create recognizer collection */
    MBRecognizerCollection *recognizerCollection = [[MBRecognizerCollection alloc] initWithRecognizers:@[self.blinkInputRecognizer]];
    
    MBBarcodeOverlayViewController *overlayVC = [[MBBarcodeOverlayViewController alloc] initWithSettings:settings recognizerCollection:recognizerCollection delegate:self];
    UIViewController<MBRecognizerRunnerViewController>* recognizerRunnerViewController = [MBViewControllerFactory recognizerRunnerViewControllerWithOverlayViewController:overlayVC];
    
    /** Present the recognizer runner view controller. You can use other presentation methods as well (instead of presentViewController) */
    [self presentViewController:recognizerRunnerViewController animated:YES completion:nil];

}

- (void)barcodeOverlayViewControllerDidFinishScanning:(MBBarcodeOverlayViewController *)barcodeOverlayViewController state:(MBRecognizerResultState)state {
    
    // this is done on background thread
    // check for valid state
    if (state == MBRecognizerResultStateValid) {
        
        // first, pause scanning until we process all the results
        [barcodeOverlayViewController.recognizerRunnerViewController pauseScanning];
        
        dispatch_async(dispatch_get_main_queue(), ^{
            // All UI interaction needs to be done on main thread
        });
    }
}

- (void)barcodeOverlayViewControllerDidTapClose:(MBBarcodeOverlayViewController *)barcodeOverlayViewController {
    // Your action on cancel 
}

@end