We recommend that you use the latest version of BlinkID SDK as it allows you to scan all supported documents without the need for country and document type selection steps.
BlinkID UI is a library that lets you scan any BlinkID supported document without even knowing what a Recognizer
is.
It includes customisable scan activity and country selection activity.
To see it in action, check our demo app.
New to BlinkID? Take a look at BlinkID SDK first.
Add Microblink and JitPack repositories to your root build.gradle file
allprojects {
repositories {
...
maven { url 'http://maven.microblink.com' }
maven { url 'https://jitpack.io' }
}
}
Include BlinkID UI dependency in your app level build.gradle file
dependencies {
implementation 'com.github.BlinkID:blinkid-ui-android:v4.11.1.3'
}
After doing a Gradle sync, you'll be able to start using BlinkID UI in your app
- first make sure that your Microblink licence is correctly configured, check BlinkID documentation for more info
- extend
BaseDocumentScanActivity
and implement required methodsgetInitialDocument()
- return the document that will be selected before the user has the chance to change itshouldScanBothDocumentSides
- most documents support scanning both front and back side, if you just want to scan one side, returnfalse
createScanFlowListener()
- this listener gets notified on scan flow updates, most importantly, you'll get final scan results inonEntireDocumentScanned
method
If you want to customise scanning behavior and UI take a look at FAQ.
To use your custom theme in scan activity, extend MbScanTheme
and override attribues you want to change.
To use custom theme in country selection activity, extend either MbChooseCountryLightTheme
or MbChooseCountryDarkTheme
and override createDocumentChooser()
in your scan activity to return your theme.
For other resources, name your resource the same as the resource you want to override in the library. For example, if you want to change torch icon, name you icon mb_ic_torch_on
.
Check the sample app for examples of customisation.
To disable translations for country names, override createLocalizationManager()
and return your custom LocaleManager
that limits languages to which to translate to.
If you want to disable translations for other strings, change your gradle configuration as explained here.
In your scan activity, override createScanSuccessSoundPlayer()
and return your own implementation. If you want to disable sound just return new EmptyScanSuccessPlayer()
.
In your scan activity, override createSplashOverlaySettings()
and return your own implementation.
In your scan activity, override createScanTimeoutHandler()
and return your own implementation. If you just want to change timeout duration you can use DefaultScanTimeoutHandler
.
In your scan activity, override createScanLineAnimator()
and return your own implementation. If you want to disable the animation, just return new EmptyScanLineAnimator()
. If you just want to change line color, provide mbScanIconScanLine
attribute in your scan activity theme.
In your scan activity, override createDocumentChooser()
and return your own subclass of DefaultDocumentChooser
, in which you'll override getCountryFilter()
to return your desired filter and override getAllowedDocumentTypes()
to return only allowed document types for a specific country.
In your scan activity, override createDocumentChooser()
and return your own implementation. Start your country selection activity in onChooseCountryClick()
.
In your scan activity, override getFrameGrabberMode()
and return FrameGrabberMode.SUCCESS_FRAMES
. Then override createFrameListener()
and return listener that will handle success frames.