Ready-to-Use UI for the Android Medical Certificate Scanner Module
Overview
Ready-to-Use UI Component (activity) that is responsible for recognizing Medical Certificates is MedicalCertificateScannerActivity
.
For an end-to-end implementation example of the RTU UI Components, take a look at our example app.
Starting and configuring RTU Medical Certificate Scanner
MedicalCertificateScanner
is included in Scanbot SDK package 4. Therefore, add the dependency io.scanbot:sdk-package-4
or higher in your build.gradle
:
implementation("io.scanbot:sdk-package-4:$latestSdkVersion")
implementation("io.scanbot:sdk-mc-assets:$latestSdkVersion")
implementation("io.scanbot:sdk-common-ocr-assets:$latestSdkVersion") // <<-- please also add this dependency
implementation("io.scanbot:io.scanbot:sdk-package-ui:$latestSdkVersion")
Some medical certificates contain additional information in the barcode. For such cases, you also have to add the dependency with the Barcode Scanner assets:
implementation("io.scanbot:sdk-barcode-assets:$latestSdkVersion")
Do not use multiple scanners (e.g., MRZ Scanner and Credit Card Scanner) at the same time.
Each scanner instance requires a lot of memory, GPU, and processor resources. Using multiple scanners will lead to performance issues for the entire application.
To use the RTU UI Components, include the corresponding dependency in your build.gradle
file:
implementation("io.scanbot:rtu-ui-v2-bundle:$latestSdkVersion")
You can get the latest $scanbotSdkVersion
from the changelog.
The Medical Certificate Scanner is based on the OCR feature of the Scanbot SDK. Please check the OCR documentation for more details.
In order to use the Medical Certificate Scanner you, need to prepare the English OCR language file.
Place the eng.traineddata
file in the assets sub-folder assets/ocr_blobs/
of your app.
Then on initialization of the SDK, call the prepareOCRLanguagesBlobs(true)
method:
loading...
Unfortunately, we have noticed that all devices using a Cortex A53 processor DO NOT SUPPORT GPU acceleration. If you encounter any problems, please disable GPU acceleration for these devices.
ScanbotSDKInitializer()
.allowGpuAcceleration(false)
To start the RTU UI Medical Certificate Scanner, you only have to start a new activity and be ready to process its result later.
Starting from version 1.90.0, the SDK's RTU UI components contain predefined AndroidX Result API contracts. They handle part of the boilerplate for starting the RTU activity component and mapping the result once it finishes.
If your code is bundled with Android's deprecated startActivityForResult
API, check the other approach we offer for this case.
- AndroidX Result API
- old 'startActivityForResult' approach
loading...
loading...
loading...
We offer some syntactic sugar for handling the result from RTU UI Components via the AndroidX Result API:
-
Every RTU UI component's activity contains a
Result
class, which (along with theresultCode
value) exposes a booleanresultOk
property. This will be true ifresultCode
equalsActivity.RESULT_OK
. -
When you only expect
Activity.RESULT_OK
result code, you can use theAppCompatActivity.registerForActivityResultOk
extension method instead ofregisterForActivityResult
. It will be triggered only when there is a non-nullable result entity present.
Always use the corresponding activity's static newIntent
method to create an intent when starting the RTU UI activity using the deprecated startActivityForResult
approach. Creating an android.content.Intent
object using its constructor (passing the activity's class as a parameter) will lead to the RTU UI Component malfunctioning.
An instance of MedicalCertificateScannerConfiguration
is required for starting the RTU UI activity. It allows configuration changes through methods it exposes:
loading...
All parameters in MedicalCertificateScannerConfiguration
are optional.
For more information about these methods, please refer to the API documentation.
Handling the result
Below is a simple example of presenting the result: MedicalCertificateScanningResult
fields, shown in a Toast notification.
loading...
You can find more information about the result class in the API documentation.
Want to scan longer than one minute?
Generate a free trial license to test the Scanbot SDK thoroughly.
Get your free Trial License