Skip to content

Commit

Permalink
added v11.4.16
Browse files Browse the repository at this point in the history
  • Loading branch information
sMaltsevAcuant committed Sep 29, 2021
1 parent ee7fb0e commit 10d20ae
Show file tree
Hide file tree
Showing 19 changed files with 77 additions and 78 deletions.
63 changes: 44 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Acuant Android SDK v11.4.15
**August 2021**
# Acuant Android SDK v11.4.16
**September 2021**

See [https://github.com/Acuant/AndroidSDKV11/releases](https://github.com/Acuant/AndroidSDKV11/releases) for release notes.

Expand Down Expand Up @@ -189,18 +189,18 @@ The SDK includes the following modules:
- Add the following dependencies

implementation 'com.acuant:acuantcommon:11.4.15'
implementation 'com.acuant:acuantcamera:11.4.15'
implementation 'com.acuant:acuantimagepreparation:11.4.15'
implementation 'com.acuant:acuantdocumentprocessing:11.4.15'
implementation 'com.acuant:acuantechipreader:11.4.15'
implementation 'com.acuant:acuantfacematch:11.4.15'
implementation 'com.acuant:acuanthgliveness:11.4.15'
implementation ('com.acuant:acuantipliveness:11.4.15'){
implementation 'com.acuant:acuantcommon:11.4.16'
implementation 'com.acuant:acuantcamera:11.4.16'
implementation 'com.acuant:acuantimagepreparation:11.4.16'
implementation 'com.acuant:acuantdocumentprocessing:11.4.16'
implementation 'com.acuant:acuantechipreader:11.4.16'
implementation 'com.acuant:acuantfacematch:11.4.16'
implementation 'com.acuant:acuanthgliveness:11.4.16'
implementation ('com.acuant:acuantipliveness:11.4.16'){
transitive = true
}
implementation 'com.acuant:acuantfacecapture:11.4.15'
implementation 'com.acuant:acuantpassiveliveness:11.4.15'
implementation 'com.acuant:acuantfacecapture:11.4.16'
implementation 'com.acuant:acuantpassiveliveness:11.4.16'

- Acuant also relies on Google Play services dependencies, which are pre-installed on almost all Android devices.

Expand Down Expand Up @@ -914,13 +914,38 @@ Relevant Enums:

### IdOptions ###

public class IdOptions {
public CardSide cardSide;
public boolean isRetrying;
public boolean isHealthCard;
public AuthenticationSensitivity authenticationSensitivity;
public TamperSensitivity tamperSensitivity;
}
public class IdOptions {
public CardSide cardSide;
public boolean isRetrying;
public boolean isHealthCard;
public AuthenticationSensitivity authenticationSensitivity;
public TamperSensitivity tamperSensitivity;
}
### NfcData (used in eChip workflow) ###

public class NfcData {
var dateOfBirth: String
var documentExpiryDate: String
var documentCode: String
var issuingAuthority: String
var documentNumber: String
var nationality: String
var personalNumber: String
var firstName: String
var lastName: String
var documentType: String
var documentSubType: String
var gender: String
val age: Int? //extrapolated
val isExpired: Boolean? //extrapolated
var image: Bitmap?
var passportDataValid: Boolean //Data Group Hash Check Status
var passportCountrySigned: OzoneResultStatus
var passportSigned: OzoneResultStatus
fun getBytes(group: ByteGroup?): ByteArray?
}

-------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,14 @@ abstract class AcuantBaseCameraFragment : Fragment() {
if (image != null) {
if (!isCapturing) {
try {
AcuantDetectorWorker(detectors, image, isAutoCapture).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR)
AcuantDetectorWorker(detectors, imageToBitmap(image), isAutoCapture).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR)
}
catch(e:Exception){
image.close()
e.printStackTrace()
}
}
else{
else {
image.close()
}
}
Expand All @@ -350,6 +351,13 @@ abstract class AcuantBaseCameraFragment : Fragment() {
}
}

private fun imageToBitmap(image: Image) : Bitmap {
val imageBytes = ImageSaver.imageToByteArray(image)
val bitmap = BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.size)
image.close()
return bitmap
}

/**
* Called only once when the camera deems the id to be properly positioned and
* is ready to take a photo
Expand All @@ -370,8 +378,7 @@ abstract class AcuantBaseCameraFragment : Fragment() {
}
}
}))
}
else{
} else {
image.close()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,6 @@ class AcuantBarcodeCameraFragment : AcuantBaseCameraFragment(),

override fun onBarcodeDetected(barcode: String) {
this.barCodeString = barcode
detectors.forEach {
if (it is AcuantBarcodeDetector) {
it.isProcessing = false
}
}

Log.d("BarcodeCamera","Barcode Detected, Done: $done")
if (!done) {
done = true
activity?.runOnUiThread {
Expand All @@ -80,7 +73,7 @@ class AcuantBarcodeCameraFragment : AcuantBaseCameraFragment(),
}

override fun onTick(millisUntilFinished: Long) {
Log.d("BarcodeCamera","Capturing: $millisUntilFinished")
//do nothing
}
}.start()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.graphics.*
import android.graphics.drawable.Drawable
import android.os.*
import android.support.v4.app.ActivityCompat
import android.util.Log
import android.util.Size
import android.util.SparseIntArray
import android.view.*
Expand Down Expand Up @@ -238,13 +239,8 @@ class AcuantDocCameraFragment : AcuantBaseCameraFragment(),
currentDigit = digitsToShow
}

override fun onBarcodeDetected(barcode: String){
override fun onBarcodeDetected(barcode: String) {
this.barCodeString = barcode
detectors.forEach {
if (it is AcuantBarcodeDetector) {
it.isProcessing = false
}
}
}

override fun onCreateView(inflater: LayoutInflater,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import com.acuant.acuantcamera.camera.AcuantBaseCameraFragment
import com.acuant.acuantcamera.camera.AcuantCameraOptions
import com.acuant.acuantcamera.camera.ICameraActivityFinish
import com.acuant.acuantcamera.constant.ACUANT_EXTRA_CAMERA_OPTIONS
import com.acuant.acuantcamera.detector.barcode.AcuantBarcodeDetector
import com.acuant.acuantcamera.detector.ocr.AcuantOcrDetector
import com.acuant.acuantcamera.detector.ocr.AcuantOcrDetectorHandler
import com.acuant.acuantcamera.helper.MrzParser
Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,19 @@
package com.acuant.acuantcamera.detector

import android.graphics.*
import android.media.Image
import android.os.AsyncTask
import com.acuant.acuantcamera.detector.document.AcuantDocumentDetector
import java.lang.Exception
import kotlin.concurrent.thread

class AcuantDetectorWorker(private val detectors: List<IAcuantDetector>, private val image: Image, private val runDocumentDetection: Boolean = true): AsyncTask<Void, Void, Void>(){
class AcuantDetectorWorker(private val detectors: List<IAcuantDetector>, private val bitmap: Bitmap, private val runDocumentDetection: Boolean = true): AsyncTask<Void, Void, Void>(){
override fun doInBackground(vararg params: Void?): Void? {
var bitmap:Bitmap? = null
try{
bitmap = imageToBitmap(image)
}
catch(e:Exception){
e.printStackTrace()
}
finally {
image.close()

detectors.forEach{
if (runDocumentDetection || it !is AcuantDocumentDetector) {
thread {
it.detect(bitmap)
}
detectors.forEach{
if (runDocumentDetection || it !is AcuantDocumentDetector) {
thread {
it.detect(bitmap)
}
}
}
return null
}

private fun imageToBitmap(image: Image):Bitmap {
val imageBytes = ImageSaver.imageToByteArray(image)
return BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.size)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import com.acuant.acuantcamera.detector.barcode.tracker.BarcodeTrackerFactory
import com.google.android.gms.vision.MultiProcessor
import com.google.android.gms.vision.Frame


//NOTE: this class does not use the isProcessing flag due to difficulties with how the gms barcode detector does its callbacks
class AcuantBarcodeDetector(context: Context, callback: AcuantBarcodeDetectorHandler) : BaseAcuantDetector() {
private lateinit var barcodeDetector: BarcodeDetector
private var isInitialized = false
Expand All @@ -26,7 +26,7 @@ class AcuantBarcodeDetector(context: Context, callback: AcuantBarcodeDetectorHan
}

override fun detect(bitmap: Bitmap?) {
if (isInitialized && bitmap != null && !isProcessing) {
if (isInitialized && bitmap != null) {
try {
barcodeDetector.receiveFrame(Frame.Builder()
.setBitmap(bitmap)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ package com.acuant.acuantcamera.detector.barcode.tracker

import android.util.Log
import com.acuant.acuantcamera.detector.barcode.AcuantBarcodeDetectorHandler
import com.google.android.gms.vision.Detector.Detections

import com.google.android.gms.vision.Tracker
import com.google.android.gms.vision.barcode.Barcode

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class AcuantDocumentDetector constructor (private val callback: AcuantDocumentDe

override fun detect(bitmap: Bitmap?) {
if (!isProcessing) {
isProcessing = true
val cropStart = System.currentTimeMillis()
var croppedImage: Image? = null

Expand All @@ -23,6 +24,7 @@ class AcuantDocumentDetector constructor (private val callback: AcuantDocumentDe
croppedImage = AcuantImagePreparation.detect(data)
} catch (e: Exception) {
e.printStackTrace()
isProcessing = false
}
}
callback.onDetected(croppedImage, System.currentTimeMillis() - cropStart)
Expand Down
Binary file modified acuantcommon/acuantcommon.aar
Binary file not shown.
Binary file modified acuantdocumentprocessing/acuantdocumentprocessing.aar
Binary file not shown.
Binary file modified acuantechipreader/acuantechipreader.aar
Binary file not shown.
Binary file modified acuantfacematch/acuantfacematch.aar
Binary file not shown.
Binary file modified acuantimagepreparation/acuantimagepreparation.aar
Binary file not shown.
Binary file modified acuantipliveness/acuantipliveness.aar
Binary file not shown.
Binary file modified acuantpassiveliveness/acuantpassiveliveness.aar
Binary file not shown.
13 changes: 6 additions & 7 deletions app/src/main/java/com/acuant/sampleapp/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1356,13 +1356,12 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemSelectedListener, IP

fun loadAssureIDImage(url: String?, credential: Credential?): Bitmap? {
if (url != null && credential != null) {
val c = URL(url).openConnection() as HttpURLConnection
val auth = CredentialHelper.getAcuantAuthHeader(credential)
c.setRequestProperty("Authorization", auth)
c.useCaches = false
c.connect()
val img = BitmapFactory.decodeStream(c.inputStream)
c.disconnect()
val conn = URL(url).openConnection() as HttpURLConnection
conn.setRequestProperty("Authorization", CredentialHelper.getAcuantAuthHeader(credential))
conn.useCaches = false
conn.connect()
val img = BitmapFactory.decodeStream(conn.inputStream)
conn.disconnect()
return img
}
return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.acuant.sampleapp.backgroundtasks

import android.os.AsyncTask
import com.acuant.acuantcommon.model.Credential
import android.util.Base64
import com.acuant.acuantcommon.helper.CredentialHelper
import org.json.JSONObject
import java.io.BufferedReader
import java.io.InputStreamReader
Expand All @@ -29,9 +29,7 @@ class AcuantTokenService(private val credential: Credential,
val conn = url.openConnection() as HttpURLConnection
try {
conn.requestMethod = "POST"
val sub = if (credential.subscription != null && credential.subscription != "") "${credential.subscription};" else ""
val auth = Base64.encodeToString("$sub${credential.username}:${credential.password}".toByteArray(), Base64.NO_WRAP)
conn.setRequestProperty("Authorization", "Basic $auth")
conn.setRequestProperty("Authorization", CredentialHelper.getAcuantAuthHeader(credential))
conn.setRequestProperty("Accept", "application/json")
conn.addRequestProperty("Cache-Control", "no-cache")
conn.addRequestProperty("Cache-Control", "max-age=0")
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@
<string name="classification_error">Could not classify the document</string>

<string name="scan_back_side_id">Scan back side of document.</string>
<string name="scan_back_side_health_insurance_card">Capture back side of health insurance card.</string>
<string name="scan_back_side_health_insurance_card">Capture back side of medical insurance card.</string>

<string name="classification_error_retry">Retry</string>
<string name="classification_error_image_preview">Image Preview</string>
<string name="id_passport_button_text">ID/Passport</string>
<string name="health_insurance_button_text">Health Insurance Card</string>
<string name="health_insurance_button_text">Medical Insurance Card</string>
<string name="auto_capture">Auto Capture</string>
<string name="ip_liveness_enabled">IP Liveness Enabled</string>
<string name="face_capture_button_text">Face Capture</string>
Expand Down

0 comments on commit 10d20ae

Please sign in to comment.