BlinkInput SDK for Android
BlinkInput SDK for Android is SDK that enables you to easily add near real-time OCR functionality to your app with a purpose to replace manual data input. With provided camera management you can easily create an app that scans receipts, e-mails and much more. As of version 1.8.0 you can also scan barcodes when using custom UI integration. You can also scan images stored as Android Bitmaps that are loaded either from the gallery, network or SD card.
With BlinkInput you can scan free-form text or specialized formats like dates, amounts, e-mails and much more. Using specialized formats yields much better scanning quality than using free-form text mode.
Using BlinkInput in your app requires a valid license. You can obtain a trial license by registering to Microblink dashboard. After registering, you will be able to generate a license key for your app. The license key is bound to package name of your app, so please make sure you enter the correct package name when asked.
See below for more information about how to integrate BlinkInput SDK into your app and also check latest Release notes.
Table of contents
Android BlinkInput integration instructions
The package contains Android Archive (AAR) that contains everything you need to use BlinkInput library. This AAR is also available in maven repository for easier integration into your app. For more information about integration procedure, check Android Studio integration section.
Besides AAR, the package also contains a sample project that contains following modules:
- BlinkInputDetectorSample demonstrates how to perform document detection and obtain a dewarped image of the detected document.
- BlinkInputDirectAPISample shows how to perform OCR of Android Bitmaps
- BlinkInputDocumentCaptureSample shows how to use document capture feature to take high resolution document images. It also shows how to implement custom scan activity by using provided overlay controller.
- BlinkInputFieldByFieldSample shows how to use simple Intent-based API to scan little text fields. It also shows you how to create a custom scan activity for scanning little text fields.
- BlinkInputTemplatingSample shows how to use Templating API to implement support for scanning generic documents
- BlinkInputRawOcrSample shows how to perform full camera frame generic OCR, by using legacy OCR engine or Deep OCR engine (uses neural networks)
The source code of all sample apps is given to you to show you how to perform integration of BlinkInput SDK into your app. You can use this source code and all resources as you wish. You can use demo apps as a basis for creating your own app, or you can copy/paste the code and/or resources from demo apps into your app and use them as you wish without even asking us for permission.
BlinkInput is supported on Android SDK version 16 (Android 4.1) or later.
The list of all provided scan activities can be found in the Built-in activities and overlays section.
For advanced use cases, you will need to embed RecognizerRunnerView into your activity and pass activity's lifecycle events to it and it will control the camera and recognition process. For more information, see Embedding RecognizerRunnerView into custom scan activity.
Quick Start
Quick start with the sample app
- Open Android Studio.
- In Quick Start dialog choose Import project (Eclipse ADT, Gradle, etc.).
- In File dialog select BlinkInputSample folder.
- Wait for the project to load. If Android studio asks you to reload project on startup, select
Yes.
SDK integration
Adding BlinkInput dependency
In your build.gradle, add BlinkInput maven repository to repositories list
repositories {
maven { url 'https://maven.microblink.com' }
}
Add BlinkInput as a dependency and make sure transitive is set to true
dependencies {
implementation('com.microblink:blinkinput:5.1.0@aar') {
transitive = true
}
}
Importing Javadoc
Android studio should automatically import javadoc from maven dependency. If that doesn't happen, you can do that manually by following these steps:
- In Android Studio project sidebar, ensure project view is enabled
- Expand
External Libraries entry (usually this is the last entry in project view)
- Locate
blinkinput-5.1.0 entry, right click on it and select Library Properties...
- A
Library Properties pop-up window will appear
- Click the second
+ button in bottom left corner of the window (the one that contains + with little globe)
- Window for defining documentation URL will appear
- Enter following address:
https://microblink.github.io/blinkinput-android/
- Click
OK
Performing your first field by field scan
-
Before starting a recognition process, you need to obtain a license from Microblink dashboard. After registering, you will be able to generate a trial license for your app. License is bound to package name of your app, so please make sure you enter the correct package name when asked.
After creating a license, you will have the option to download the license as a file that you must place within your application's assets folder. You must ensure that license key is set before instantiating any other classes from the SDK, otherwise you will get an exception at runtime. Therefore, we recommend that you extend Android Application class and set the license in its onCreate callback in the following way:
public class MyApplication extends Application {
@Override
public void onCreate() {
MicroblinkSDK.setLicenseFile("path/to/license/file/within/assets/dir", this);
}
}