Skip to content

Commit

Permalink
Merge pull request #276 from BlinkID/release/v5.17.0
Browse files Browse the repository at this point in the history
Release/v5.17.0
  • Loading branch information
krizaa authored Jun 10, 2022
2 parents 474665a + 6d615d8 commit 71499c2
Show file tree
Hide file tree
Showing 72 changed files with 5,234 additions and 1,321 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
package com.microblink.blinkid;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import androidx.activity.result.ActivityResultLauncher;
import androidx.appcompat.app.AppCompatActivity;

import com.microblink.activity.result.ScanResult;
import com.microblink.activity.result.contract.MbScan;
import com.microblink.entities.recognizers.RecognizerBundle;
import com.microblink.entities.recognizers.blinkid.generic.BlinkIdCombinedRecognizer;
import com.microblink.uisettings.ActivityRunner;
import com.microblink.uisettings.BlinkIdUISettings;

import androidx.appcompat.app.AppCompatActivity;
import com.microblink.uisettings.UISettings;

public class MainActivity extends AppCompatActivity {

public static final int MY_BLINKID_REQUEST_CODE = 123;

private BlinkIdCombinedRecognizer recognizer;
private RecognizerBundle recognizerBundle;

Expand All @@ -37,27 +37,24 @@ public void onScanButtonClick(View view) {
BlinkIdUISettings uiSettings = new BlinkIdUISettings(recognizerBundle);

// start scan activity based on UI settings
ActivityRunner.startActivityForResult(this, MY_BLINKID_REQUEST_CODE, uiSettings);
blinkIdScanLauncher.launch(uiSettings);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);

// onActivityResult is called whenever we returned from activity started with startActivityForResult
// We need to check request code to determine that we have really returned from BlinkID activity
if (requestCode != MY_BLINKID_REQUEST_CODE) {
return;
}

if (resultCode == Activity.RESULT_OK) {
// OK result code means scan was successful
onScanSuccess(data);
} else {
// user probably pressed Back button and cancelled scanning
onScanCanceled();
}
}
private final ActivityResultLauncher<UISettings> blinkIdScanLauncher = registerForActivityResult(
new MbScan(),
result -> {
if (result.getResultStatus() == ScanResult.ResultStatus.FINISHED) {
// OK result code means scan was successful
onScanSuccess(result.getData());
} else if (result.getResultStatus() == ScanResult.ResultStatus.EXCEPTION) {
Toast.makeText(this, result.getException().toString(), Toast.LENGTH_SHORT).show();
} else {
// user probably pressed Back button and cancelled scanning
onScanCanceled();
}
}

);

private void onScanSuccess(Intent data) {
// update recognizer results with scanned data
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.microblink.result.extract.blinkid.generic;

import com.microblink.entities.recognizers.blinkid.generic.BlinkIdCombinedRecognizer;
import com.microblink.entities.recognizers.blinkid.generic.DataMatchDetailedInfo;
import com.microblink.entities.recognizers.blinkid.generic.DriverLicenseDetailedInfo;
import com.microblink.entities.recognizers.blinkid.generic.barcode.BarcodeResult;
import com.microblink.entities.recognizers.blinkid.generic.classinfo.ClassInfo;
Expand Down Expand Up @@ -123,6 +124,7 @@ private void extractMixedResults(BlinkIdCombinedRecognizer.Result result) {
add(R.string.MBRecognitionMode, result.getRecognitionMode().name());

add(R.string.PPDocumentBothSidesMatch, result.getDocumentDataMatch().name());
add(R.string.PPDataMatchDetailedInfo, extractDataMatchDetailedInfo(result.getDataMatchDetailedInfo()));

add(R.string.MBFrontCameraFrame, result.getFrontCameraFrame());
add(R.string.MBBackCameraFrame, result.getBackCameraFrame());
Expand Down Expand Up @@ -243,4 +245,11 @@ protected void onDataExtractionDone(BlinkIdCombinedRecognizer.Result result, Res
}
}

private String extractDataMatchDetailedInfo(DataMatchDetailedInfo dataMatchDetailedInfo) {
return mContext.getString(R.string.PPDocumentBothSidesMatch) + ": " + dataMatchDetailedInfo.getDataMatchResult().name() + "\n"
+ mContext.getString(R.string.PPDocumentNumberMatch) + ": " + dataMatchDetailedInfo.getDocumentNumber().name() + "\n"
+ mContext.getString(R.string.PPDDateOfBirthMatch) + ": " + dataMatchDetailedInfo.getDateOfBirth().name() + "\n"
+ mContext.getString(R.string.PPDDateOfExpiryMatch) + ": " + dataMatchDetailedInfo.getDateOfExpiry().name() + "\n";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@
<string name="PPMRZParsed">MRZ parsed</string>
<string name="PPMRZVerified">MRZ verified</string>
<string name="PPDocumentBothSidesMatch">Document Both Sides Match</string>
<string name="PPDataMatchDetailedInfo">Data match detailed info</string>
<string name="PPDocumentNumberMatch">Document number data match</string>
<string name="PPDDateOfBirthMatch">Date of birth data match</string>
<string name="PPDDateOfExpiryMatch">Date of expiry data match</string>
<string name="PPPrimaryId">Primary ID</string>
<string name="PPSecondaryId">Secondary ID</string>
<string name="PPDateOfBirth">Date of birth</string>
Expand Down
2 changes: 1 addition & 1 deletion BlinkIDSample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ allprojects {
// versions of libraries that all modules require

project.ext {
blinkIdVersion = '5.16.1'
blinkIdVersion = '5.17.0'
compileSdkVersion = 31
targetSdkVersion = 31
appCompatVersion = '1.4.0'
Expand Down
Binary file modified LibBlinkID-javadoc.jar
Binary file not shown.
Binary file modified LibBlinkID.aar
Binary file not shown.
78 changes: 39 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Add _BlinkID_ as a dependency and make sure `transitive` is set to true

```
dependencies {
implementation('com.microblink:blinkid:5.16.1@aar') {
implementation('com.microblink:blinkid:5.17.0@aar') {
transitive = true
}
}
Expand All @@ -125,7 +125,7 @@ Android studio 3.0 should automatically import javadoc from maven dependency. If

1. In Android Studio project sidebar, ensure [project view is enabled](https://developer.android.com/sdk/installing/studio-androidview.html)
2. Expand `External Libraries` entry (usually this is the last entry in project view)
3. Locate `blinkid-5.16.1` entry, right click on it and select `Library Properties...`
3. Locate `blinkid-5.17.0` entry, right click on it and select `Library Properties...`
4. A `Library Properties` pop-up window will appear
5. Click the second `+` button in bottom left corner of the window (the one that contains `+` with little globe)
6. Window for defining documentation URL will appear
Expand All @@ -134,7 +134,7 @@ Android studio 3.0 should automatically import javadoc from maven dependency. If


#### Performing your first scan
1. First you'll need to create an account at [Microblink dashboard](https://microblink.com/login) where you can generate a free trial license key for your app. License is bound to [package name](http://tools.android.com/tech-docs/new-build-system/applicationid-vs-packagename) of your app, so please make sure you enter the correct package name when asked.
1. A valid license key is required to initialize scanning. You can request a free trial license key, after you register, at [Microblink Developer Hub](https://account.microblink.com/signin). License is bound to [package name](http://tools.android.com/tech-docs/new-build-system/applicationid-vs-packagename) of your app, so please make sure you enter the correct package name when asked.

Download your licence file and put it in your application's _assets_ folder. Make sure to set the license key before using any other classes from the SDK, otherwise you will get a runtime exception.

Expand All @@ -151,7 +151,7 @@ Android studio 3.0 should automatically import javadoc from maven dependency. If

2. In your main activity, create recognizer objects that will perform image recognition, configure them and put them into [RecognizerBundle object](https://blinkid.github.io/blinkid-android/com/microblink/entities/recognizers/RecognizerBundle.html). You can see more information about available recognizers and `RecognizerBundle` [here](#availableRecognizers).

For example, to scan supported document, configure your recognizer like this:
For example, to scan supported document, configure your recognizer like this:

```java
public class MyActivity extends Activity {
Expand All @@ -174,23 +174,23 @@ Android studio 3.0 should automatically import javadoc from maven dependency. If
```

3. Start recognition process by creating `BlinkIdUISettings` and calling [`ActivityRunner.startActivityForResult`](https://blinkid.github.io/blinkid-android/com/microblink/uisettings/ActivityRunner.html#startActivityForResult-android.app.Activity-int-com.microblink.uisettings.UISettings-):
```java
// method within MyActivity from previous step
public void startScanning() {
```java
// method within MyActivity from previous step
public void startScanning() {
// Settings for BlinkIdActivity
BlinkIdUISettings settings = new BlinkIdUISettings(mRecognizerBundle);

// tweak settings as you wish

// Start activity
ActivityRunner.startActivityForResult(this, MY_REQUEST_CODE, settings);
}
```
}
```
4. `onActivityResult` will be called in your activity after scanning is finished, here you can get the scanning results.

```java
```java
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Expand All @@ -211,9 +211,9 @@ Android studio 3.0 should automatically import javadoc from maven dependency. If
}
}
}
```
For more information about available recognizers and `RecognizerBundle`, see [RecognizerBundle and available recognizers](#availableRecognizers).
```
For more information about available recognizers and `RecognizerBundle`, see [RecognizerBundle and available recognizers](#availableRecognizers).

# <a name="supportCheck"></a> Device requirements

Expand Down Expand Up @@ -242,7 +242,7 @@ For more information, see [Processor architecture considerations](#archConsider)
### Compatibility check

Here's how you can check whether the _BlinkID_ is supported on the device:
```java
// check if BlinkID is supported on the device,
RecognizerCompatibilityStatus status = RecognizerCompatibility.getRecognizerCompatibilityStatus(this);
Expand All @@ -253,7 +253,7 @@ if (status == RecognizerCompatibilityStatus.RECOGNIZER_SUPPORTED) {
} else if (status == RecognizerCompatibilityStatus.PROCESSOR_ARCHITECTURE_NOT_SUPPORTED) {
Toast.makeText(this, "BlinkID is not supported on current processor architecture!", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(this, "BlinkID is not supported! Reason: " + status.name(), Toast.LENGTH_LONG).show();
Toast.makeText(this, "BlinkID is not supported! Reason: " + status.name(), Toast.LENGTH_LONG).show();
}
```
Expand All @@ -264,7 +264,7 @@ If you already have an array of recognizers, you can easily filter out recognize
```java
Recognizer[] recArray = ...;
if(!RecognizerCompatibility.cameraHasAutofocus(CameraType.CAMERA_BACKFACE, this)) {
recArray = RecognizerUtils.filterOutRecognizersThatRequireAutofocus(recArray);
recArray = RecognizerUtils.filterOutRecognizersThatRequireAutofocus(recArray);
}
```
# <a name="uiCustomizations"></a> _BlinkID_ SDK integration levels
Expand Down Expand Up @@ -367,7 +367,7 @@ This section discusses how to embed [RecognizerRunnerView](https://blinkid.githu
2. It is recommended to keep your scan activity in one orientation, such as `portrait` or `landscape`. Setting `sensor` as scan activity's orientation will trigger full restart of activity whenever device orientation changes. This will provide very poor user experience because both camera and _BlinkID_ native library will have to be restarted every time. There are measures against this behaviour that are discussed [later](#scanOrientation).
3. In your activity's `onCreate` method, create a new `RecognizerRunnerView`, set [RecognizerBundle](https://blinkid.github.io/blinkid-android/com/microblink/entities/recognizers/RecognizerBundle.html) containing recognizers that will be used by the view, define [CameraEventsListener](https://blinkid.github.io/blinkid-android/com/microblink/view/CameraEventsListener.html) that will handle mandatory camera events, define [ScanResultListener](https://blinkid.github.io/blinkid-android/com/microblink/view/recognition/ScanResultListener.html) that will receive call when recognition has been completed and then call its `create` method. After that, add your views that should be layouted on top of camera view.
4. Pass in your activity's lifecycle using `setLifecycle` method to enable automatic handling of lifeceycle events.
Here is the minimum example of integration of `RecognizerRunnerView` as the only view in your activity:
```java
Expand Down Expand Up @@ -731,20 +731,20 @@ Strings used within built-in activities and overlays can be localized to any lan
However, if you use our built-in activities or overlays, they will use resources packed within `LibBlinkID.aar` to display strings and images on top of the camera view. We have already prepared strings for several languages which you can use out of the box. You can also [modify those strings](#stringChanging), or you can [add your own language](#addLanguage).

To use a language, you have to enable it from the code:
* To use a certain language, on application startup, before opening any UI component from the SDK, you should call method `LanguageUtils.setLanguageAndCountry(language, country, context)`. For example, you can set language to Croatian like this:
```java
// define BlinkID language
LanguageUtils.setLanguageAndCountry("hr", "", this);
```
```java
// define BlinkID language
LanguageUtils.setLanguageAndCountry("hr", "", this);
```

#### <a name="addLanguage"></a> Adding new language

_BlinkID_ can easily be translated to other languages. The `res` folder in `LibBlinkID.aar` archive has folder `values` which contains `strings.xml` - this file contains english strings. In order to make e.g. croatian translation, create a folder `values-hr` in your project and put the copy of `strings.xml` inside it (you might need to extract `LibBlinkID.aar` archive to access those files). Then, open that file and translate the strings from English into Croatian.

#### <a name="stringChanging"></a> Changing strings in the existing language
To modify an existing string, the best approach would be to:

1. Choose a language you want to modify. For example Croatian ('hr').
Expand Down Expand Up @@ -996,10 +996,10 @@ To remove support for a certain CPU architecture only for _BlinkID_, add the fol

```
android {
...
packagingOptions {
exclude 'lib/<ABI>/libBlinkID.so'
}
...
packagingOptions {
exclude 'lib/<ABI>/libBlinkID.so'
}
}
```

Expand Down Expand Up @@ -1055,17 +1055,17 @@ If you are having problems with scanning certain items, undesired behaviour on s
* enable logging to get the ability to see what is library doing. To enable logging, put this line in your application:
```java
com.microblink.util.Log.setLogLevel(com.microblink.util.Log.LogLevel.LOG_VERBOSE);
```
```java
com.microblink.util.Log.setLogLevel(com.microblink.util.Log.LogLevel.LOG_VERBOSE);
```
After this line, library will display as much information about its work as possible. Please save the entire log of scanning session to a file that you will send to us. It is important to send the entire log, not just the part where crash occurred, because crashes are sometimes caused by unexpected behaviour in the early stage of the library initialization.
After this line, library will display as much information about its work as possible. Please save the entire log of scanning session to a file that you will send to us. It is important to send the entire log, not just the part where crash occurred, because crashes are sometimes caused by unexpected behaviour in the early stage of the library initialization.
* Contact us at [help.microblink.com](http://help.microblink.com) describing your problem and provide following information:
* log file obtained in previous step
* high resolution scan/photo of the item that you are trying to scan
* information about device that you are using - we need exact model name of the device. You can obtain that information with any app like [this one](https://play.google.com/store/apps/details?id=ru.andr7e.deviceinfohw)
* please stress out that you are reporting problem related to Android version of _BlinkID_ SDK
* log file obtained in previous step
* high resolution scan/photo of the item that you are trying to scan
* information about device that you are using - we need exact model name of the device. You can obtain that information with any app like [this one](https://play.google.com/store/apps/details?id=ru.andr7e.deviceinfohw)
* please stress out that you are reporting problem related to Android version of _BlinkID_ SDK
# <a name="faq"></a> FAQ and known issues
Expand Down
13 changes: 13 additions & 0 deletions Release notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Release notes

## 5.17.0

### New features:
- We've added support for launching the scan activity via the new Activity Result API. Check out our sample to see how to implement it.

### Changes to BlinkID(Combined) Recognizer
- Introduced the expanded DataMatch functionality for the BlinkID with the new result member called `dataMatchDetailedInfo`
- This result member will enable you to see for which field has been performed, or it did not, the DataMatch functionality. This is enabled for `dateOfBirth`, `documentNumber` and `dateOfExpiry`.
- For example, if the date of expiry is scanned from the front and back side of the document and values do not match, this method will return DataMatchResult: `Failed`.
Result will be DataMatchResult: `Success` only if scanned values for all fields that are compared are the same. If data matching has not been performed, the result will be DataMatchResult: `NotPerformed`. This information is available for every of the three mentioned field values above.

- Fixed issues with scanning Argentina AlienID, where there were confusions with the regular ID. `ClassInfo` now correctly returns which ID type is present based on the barcode data.

## 5.16.1

### Fixes
Expand Down
2 changes: 1 addition & 1 deletion builtFromCommit.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Built from commit 3ecd369ce63262faa093893cc88fd9efa12e5d43
Built from commit b9be50c63add3d3f5a813a8de7114f6fe2e041ec
Loading

0 comments on commit 71499c2

Please sign in to comment.