Skip to content

Commit

Permalink
[android] updated bindings for v4.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
i1E committed Apr 26, 2019
1 parent cb57c47 commit b7c6632
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 2 deletions.
1 change: 1 addition & 0 deletions BlinkID/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/BruneiTemporaryResidencePermitFrontRecognizerSerialization.java" target-dir="src/com/phonegap/plugins/microblink/recognizers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/SloveniaCombinedRecognizerSerialization.java" target-dir="src/com/phonegap/plugins/microblink/recognizers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/SingaporeDlFrontRecognizerSerialization.java" target-dir="src/com/phonegap/plugins/microblink/recognizers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/PassportRecognizerSerialization.java" target-dir="src/com/phonegap/plugins/microblink/recognizers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/EudlRecognizerSerialization.java" target-dir="src/com/phonegap/plugins/microblink/recognizers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/CroatiaCombinedRecognizerSerialization.java" target-dir="src/com/phonegap/plugins/microblink/recognizers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/SingaporeChangiEmployeeIdRecognizerSerialization.java" target-dir="src/com/phonegap/plugins/microblink/recognizers/serialization" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ private void registerMapping( RecognizerSerialization recognizerSerialization )
registerMapping(new MrtdCombinedRecognizerSerialization());
registerMapping(new MrtdRecognizerSerialization());
registerMapping(new NewZealandDlFrontRecognizerSerialization());
registerMapping(new PassportRecognizerSerialization());
registerMapping(new Pdf417RecognizerSerialization());
registerMapping(new PolandCombinedRecognizerSerialization());
registerMapping(new PolandIdBackRecognizerSerialization());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public final class DocumentFaceRecognizerSerialization implements RecognizerSeri
recognizer.setNumStableDetectionsThreshold(jsonRecognizer.optInt("numStableDetectionsThreshold", 6));
recognizer.setReturnFaceImage(jsonRecognizer.optBoolean("returnFaceImage", false));
recognizer.setReturnFullDocumentImage(jsonRecognizer.optBoolean("returnFullDocumentImage", false));
recognizer.setTryBothOrientations(jsonRecognizer.optBoolean("tryBothOrientations", true));
return recognizer;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public JSONObject serializeResult(Recognizer<?, ?> recognizer) {
jsonResult.put("mrzVerified", result.isMrzVerified());
jsonResult.put("nationality", result.getNationality());
jsonResult.put("placeOfBirth", result.getPlaceOfBirth());
jsonResult.put("rawMrzString", result.getRawMrzString());
jsonResult.put("scanningFirstSideDone", result.isScanningFirstSideDone());
jsonResult.put("sex", result.getSex());
jsonResult.put("signatureImage", SerializationUtils.encodeImageBase64(result.getSignatureImage()));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.phonegap.plugins.microblink.recognizers.serialization;

import com.microblink.entities.recognizers.Recognizer;
import com.phonegap.plugins.microblink.recognizers.RecognizerSerialization;

import org.json.JSONException;
import org.json.JSONObject;

public final class PassportRecognizerSerialization implements RecognizerSerialization {

@Override
public Recognizer<?, ?> createRecognizer(JSONObject jsonRecognizer) {
com.microblink.entities.recognizers.blinkid.passport.PassportRecognizer recognizer = new com.microblink.entities.recognizers.blinkid.passport.PassportRecognizer();
recognizer.setDetectGlare(jsonRecognizer.optBoolean("detectGlare", true));
recognizer.setFaceImageDpi(jsonRecognizer.optInt("faceImageDpi", 250));
recognizer.setFullDocumentImageDpi(jsonRecognizer.optInt("fullDocumentImageDpi", 250));
recognizer.setFullDocumentImageExtensionFactors(BlinkIDSerializationUtils.deserializeExtensionFactors(jsonRecognizer.optJSONObject("fullDocumentImageExtensionFactors")));
recognizer.setReturnFaceImage(jsonRecognizer.optBoolean("returnFaceImage", false));
recognizer.setReturnFullDocumentImage(jsonRecognizer.optBoolean("returnFullDocumentImage", false));
return recognizer;
}

@Override
public JSONObject serializeResult(Recognizer<?, ?> recognizer) {
com.microblink.entities.recognizers.blinkid.passport.PassportRecognizer.Result result = ((com.microblink.entities.recognizers.blinkid.passport.PassportRecognizer)recognizer).getResult();
JSONObject jsonResult = new JSONObject();
try {
SerializationUtils.addCommonResultData(jsonResult, result);
jsonResult.put("faceImage", SerializationUtils.encodeImageBase64(result.getFaceImage()));
jsonResult.put("fullDocumentImage", SerializationUtils.encodeImageBase64(result.getFullDocumentImage()));
jsonResult.put("mrzResult", BlinkIDSerializationUtils.serializeMrzResult(result.getMrzResult()));
} catch (JSONException e) {
// see https://developer.android.com/reference/org/json/JSONException
throw new RuntimeException(e);
}
return jsonResult;
}

@Override
public String getJsonName() {
return "PassportRecognizer";
}

@Override
public Class<?> getRecognizerClass() {
return com.microblink.entities.recognizers.blinkid.passport.PassportRecognizer.class;
}
}
2 changes: 1 addition & 1 deletion BlinkID/src/android/libBlinkID.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repositories {

dependencies {
implementation "com.android.support:appcompat-v7:27.1.1"
implementation('com.microblink:blinkid:4.8.0@aar') {
implementation('com.microblink:blinkid:4.9.0@aar') {
transitive = false
}
}
Expand Down
2 changes: 1 addition & 1 deletion www/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ var app = {

// package name/bundleID com.microblink.blinkid
var licenseKeys = {
android: 'sRwAAAAWY29tLm1pY3JvYmxpbmsuYmxpbmtpZJ9ew00uWSf86/ux5PGYgpVxe8daSAIioOFooMH1zSjCtUFYDv9AqV87Ew8fx8H/ag2O5/E1nN18stdwBpBjEvyG+tOKGyUYC3WecONS+6edT6mBfhwXh11Qgkn/eMeip1ep/k/tMcs4IPI6xLzevdpUY8YLwcWAlBGoCmYo6ijxrnKXcRck2FpXUdZedgOH0mRtTrSyT40DBjuA6O11rYPnCX1phzsobd2S71qVLoZ+zHg+60e3ePigLxIKiA==',
android: 'sRwAAAAWY29tLm1pY3JvYmxpbmsuYmxpbmtpZJ9ew00uWSf86/ux5PUoKjyTpOK/Xi9t7cx7ZuiLoN86RhkY28pvSxf0MuuwpIa3oFeAFWqNOB+joH0zcxSCfOp5wSZFvatFB0TFDUubaP6X+iJQtok7/qx3Ioy503yXeyQPJG/Grr510Gh3q4n1kgy+U3ZEsYusp/UN8CdExK/+gW2UL5d3iKzqNeAonpVDPS3B70fRUcm8abLqxYyjSjZp/1Pum4Fdye7AlcGXnv3vnB2O7g4LrJ419mNaOg==',
ios: 'sRwAAAEWY29tLm1pY3JvYmxpbmsuYmxpbmtpZFG2rW9X4lA0y++ptbiZ7dj1E80ExjC//oFNqdO1aP3BzyX/8qAoWiV5mCPgIIDWRIXc2UdU0OrG+6/mEPb2u6EGhxMIXonSGsd8WICdxSV+baMRJck21qyZoCgRwz+eC0MXrTaPt1jqWVKHjYT7BvPaC8p+EV8RY6Vph89PLKDZxsvxM93HVFB7cah4xN12S6gNrtm25aIMEbpBInI40zmtpCBGoU8KR3U21A8spXVHZyGcGsG3guOSsqpsNg=='
};

Expand Down

0 comments on commit b7c6632

Please sign in to comment.