only_for_trial

Note:- Add only_for_trial under dependencies in your pubspec.yaml file.

1.Setup Android

Add this permissions into Android’s AndroidManifest.xml file.

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />

Add it in your root build.gradle at the end of repositories.

allprojects {
   repositories {
       google()
       jcenter()
       maven {
           url 'https://jitpack.io'
           credentials { username 'jp_ssguccab6c5ge2l4jitaj92ek2' }
       }    
    }
}

Add it in your app/build.gradle file.

packagingOptions {
   pickFirst 'lib/arm64-v8a/libcrypto.so'
   pickFirst 'lib/arm64-v8a/libssl.so'
   
   pickFirst 'lib/armeabi-v7a/libcrypto.so'
   pickFirst 'lib/armeabi-v7a/libssl.so'
   
   pickFirst 'lib/x86/libcrypto.so'
   pickFirst 'lib/x86/libssl.so'
   
   pickFirst 'lib/x86_64/libcrypto.so'
   pickFirst 'lib/x86_64/libssl.so'
   
}

2.Setup iOS

1.Install Git LFS using command install git-lfs

2.Run pod install

Add this permissions into iOS Info.plist file.

<key>NSCameraUsageDescription</key>
<string>App usage camera for scan documents.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>App usage photos for get document picture.</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>App usage photos for save document picture.</string>

3.Setup Accura license into your projects

Accura has two license require for use full functionality of this library. Generate your own Accura license from here

key.license

This license is compulsory for this library to work. it will get all setup of accura SDK.

accuraface.license

This license is use for get face match percentages between two face pictures. And also for Passive Liveness.

Usage

Import flutter library into file. import 'package:flutter_accura_ocr/flutter_accura_ocr.dart';

➜ Get license configuration from SDK. It returns all active functionalities of your license.

 try {
   await OnlyForTrial.getMetaData().then((value) =>
       dynamic result = json.decode(value);
 }on PlatformException{}

Error: String

Success: JSON String Response = {

countries: Array<CountryModels>,

barcodes: Array[],

isValid: boolean,

isOCREnable: boolean,

isBarcodeEnable: boolean,

isBankCardEnable: boolean,

isMRZEnable: boolean

}

➜ Set AccuraScan Configuration, Error Messages and Scan Messages.

  Future<void> setAccuraConfig() async{
    try {
    
      //Configurations
   await OnlyForTrial.setFaceBlurPercentage(80);   // 0 for clean face and 100 for Blurry face
   await OnlyForTrial.setHologramDetection(true);  // true to check hologram on face
   await OnlyForTrial.setLowLightTolerance(10);    // 0 for full dark document and 100 for full bright document
   
   // 1 - allows 1% motion on document and
   // 100 - it can not detect motion and allow document to scan.
   await OnlyForTrial.setMotionThreshold(25);
   
   // Set min and max percentage for glare
   await OnlyForTrial.setMinGlarePercentage(6);
   await OnlyForTrial.setMaxGlarePercentage(99);
   
   await OnlyForTrial.setBlurPercentage(60);       // 0 for clean document and 100 for Blurry document
   await OnlyForTrial.setCameraFacing(0);          // 0 for Back Camera and 1 for Front Camera
   await OnlyForTrial.isCheckPhotoCopy(false);     // Set allow photocopy document or not
      
      //Scan Messages
      await OnlyForTrial.SCAN_TITLE_OCR_FRONT("Scan Front side of ");
      await OnlyForTrial.SCAN_TITLE_OCR_BACK("Scan Back side of ");
      await OnlyForTrial.SCAN_TITLE_OCR("Scan ");
      await OnlyForTrial.SCAN_TITLE_MRZ_PDF417_FRONT("Scan Front Side of Document");
      await OnlyForTrial.SCAN_TITLE_MRZ_PDF417_BACK("Scan Back Side of Document");
      await OnlyForTrial.SCAN_TITLE_DLPLATE("Scan Number plate");
      await OnlyForTrial.SCAN_TITLE_BARCODE("Scan Barcode");
      await OnlyForTrial.SCAN_TITLE_BANKCARD("Scan BankCard");
      
      //Error Messages
      await OnlyForTrial.ACCURA_ERROR_CODE_MOTION("Keep Document Steady");
      await OnlyForTrial.ACCURA_ERROR_CODE_DOCUMENT_IN_FRAME("Keep document in frame");
      await OnlyForTrial.ACCURA_ERROR_CODE_BRING_DOCUMENT_IN_FRAME("Bring card near to frame");
      await OnlyForTrial.ACCURA_ERROR_CODE_PROCESSING("Processing");
      await OnlyForTrial.ACCURA_ERROR_CODE_BLUR_DOCUMENT("Blur detect in document");
      await OnlyForTrial.ACCURA_ERROR_CODE_FACE_BLUR("Blur detected over face");
      await OnlyForTrial.ACCURA_ERROR_CODE_GLARE_DOCUMENT("Glare detect in document");
      await OnlyForTrial.ACCURA_ERROR_CODE_HOLOGRAM("Hologram Detected");
      await OnlyForTrial.ACCURA_ERROR_CODE_DARK_DOCUMENT("Low lighting detected");
      await OnlyForTrial.ACCURA_ERROR_CODE_PHOTO_COPY_DOCUMENT("Can not accept Photo Copy Document");
      await OnlyForTrial.ACCURA_ERROR_CODE_FACE("Face not detected");
      await OnlyForTrial.ACCURA_ERROR_CODE_MRZ("MRZ not detected");
      await OnlyForTrial.ACCURA_ERROR_CODE_PASSPORT_MRZ("Passport MRZ not detected");
      await OnlyForTrial.ACCURA_ERROR_CODE_ID_MRZ("ID MRZ not detected");
      await OnlyForTrial.ACCURA_ERROR_CODE_VISA_MRZ("Visa MRZ not detected");
      await OnlyForTrial.ACCURA_ERROR_CODE_UPSIDE_DOWN_SIDE("Document is upside down. Place it properly");
      await OnlyForTrial.ACCURA_ERROR_CODE_WRONG_SIDE("Scanning wrong side of Document");
      await OnlyForTrial.isShowLogo(0);
      
      await OnlyForTrial.setAccuraConfigs();

    }on PlatformException{}
  }

➜ Method for scan MRZ documents.

Future<void> startMRZ() async {
try {
var config = [
  {"enableLogs": false},
  mrzselected,
];
await OnlyForTrial.startMRZ(config)
    .then((value) => {
  setState((){
    dynamic result = json.decode(value);
  })
}).onError((error, stackTrace) => {
});
} on PlatformException {}
}

MRZType: String

value: other_mrz or passport_mrz or id_mrz or visa_mrz

CountryList: String

value: all or IND,USA

Success: JSON Response {

front_data: JSONObjects?,

back_data: JSONObjects?,

type: Recognition Type,

face: URI?

front_img: URI?

back_img: URI?

}

Error: String

➜ Method for scan OCR documents.

Future<void> startOCR() async {
try {
var config = [
  {"enableLogs": false},
  widget.countrySelect['id'],
  cardSelected['id'],
  cardSelected['name'],
  cardSelected['type'],
];
await OnlyForTrial.startOcrWithCard(config)
    .then((value) =>
{
  setState(() {
    dynamic result = json.decode(value);
  })
})
    .onError((error, stackTrace) =>
{
});
} on PlatformException {}
}

CountryId: integer

value: Id of selected country.

CardId: integer

value: Id of selected card.

CardName: String

value: Name of selected card.

CardType: integer

value: Type of selected card.

Success: JSON Response { }

Error: String

➜ Method for scan barcode.

Future<void> startBarcode() async{
var config= barcodeSelected;
await OnlyForTrial.startBarcode([config]).then((value) => {
setState((){
  dynamic result = json.decode(value);
})
});
}

BarcodeType: String

value: Type of barcode documents.

Success: JSON Response { }

Error: String

➜ Method for scan bankcard.

Future<void> startBankCard() async{

try{
await OnlyForTrial.startBankCard().then((value) => {
  setState((){
    dynamic result = json.decode(value);
  })
});
}on PlatformException{}
}

Success: JSON Response { }

Error: String

➜ Method for get face match percentages between two face.

Future<void> startFaceMatch() async{
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
try{
var accuraConfs = {
  "face_uri":this.faceMatchURL
};

await OnlyForTrial.setFaceMatchFeedbackTextSize(18);
await OnlyForTrial.setFaceMatchFeedBackframeMessage("Frame Your Face");
await OnlyForTrial.setFaceMatchFeedBackAwayMessage("Move Phone Away");
await OnlyForTrial.setFaceMatchFeedBackOpenEyesMessage("Keep Your Eyes Open");
await OnlyForTrial.setFaceMatchFeedBackCloserMessage("Move Phone Closer");
await OnlyForTrial.setFaceMatchFeedBackCenterMessage("Move Phone Center");
await OnlyForTrial.setFaceMatchFeedbackMultipleFaceMessage("Multiple Face Detected");
await OnlyForTrial.setFaceMatchFeedBackFaceSteadymessage("Keep Your Head Straight");
await OnlyForTrial.setFaceMatchFeedBackLowLightMessage("Low light detected");
await OnlyForTrial.setFaceMatchFeedBackBlurFaceMessage("Blur Detected Over Face");
await OnlyForTrial.setFaceMatchFeedBackGlareFaceMessage("Glare Detected");
await OnlyForTrial.setBlurPercentage(80);
await OnlyForTrial.setFaceMatchGlarePercentage_0(-1);
await OnlyForTrial.setFaceMatchGlarePercentage_1(-1);
await OnlyForTrial.startFaceMatch([accuraConfs])
    .then((value) => {
  setState((){
    dynamic result = json.decode(value);
  })
}).onError((error, stackTrace) => {
});
}on PlatformException{}
}

accuraConfs: JSON Object

face_uri: URI

Success: JSON Response { detect: URI? score: Float }

Error: String

➜ Method for liveness check.

Future<void> startLiveness() async{
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
try{
var accuraConfs = {
  "face_uri":this.faceMatchURL
};

await OnlyForTrial.setLivenessFeedbackTextSize(18);
await OnlyForTrial.setLivenessFeedBackframeMessage("Frame Your Face");
await OnlyForTrial.setLivenessFeedBackAwayMessage("Move Phone Away");
await OnlyForTrial.setLivenessFeedBackOpenEyesMessage("Keep Your Eyes Open");
await OnlyForTrial.setLivenessFeedBackCloserMessage("Move Phone Closer");
await OnlyForTrial.setLivenessFeedBackCenterMessage("Move Phone Closer");
await OnlyForTrial.setLivenessFeedbackMultipleFaceMessage("Multiple Face Detected");
await OnlyForTrial.setLivenessFeedBackFaceSteadymessage("Keep Your Head Straight");
await OnlyForTrial.setLivenessFeedBackBlurFaceMessage("Blur Detected Over Face");
await OnlyForTrial.setLivenessFeedBackGlareFaceMessage("Glare Detected");
await OnlyForTrial.setLivenessBlurPercentage(80);
await OnlyForTrial.setLivenessGlarePercentage_0(-1);
await OnlyForTrial.setLivenessGlarePercentage_1(-1);
await OnlyForTrial.setLivenessFeedBackLowLightMessage("Low light detected");
await OnlyForTrial.setLivenessfeedbackLowLightTolerence(39);
await OnlyForTrial.setLivenessURL("https://accurascan.com:8443");

await OnlyForTrial.startLiveness([accuraConfs])
    .then((value) => {
  setState((){
    dynamic result = json.decode(value);
  })
}).onError((error, stackTrace) => {
});
}on PlatformException{}
}

accuraConfs: JSON Object

face_uri: 'uri of face'

Success: JSON Response {

detect: URI?,

Face_score: Float,

score: Float,

}

Error: String

➜ Method for Only Facematch.

For gallery 1

try{
var accuraConfs = {
  "face1": this.facematchURI,
  "face2": this.facematchURI2
};

await OnlyForTrial.getGallery1([accuraConfs]).then((value) => {
  setState(() {
    dynamic result = json.decode(value);
    String facematchURI = result["Image"];
    if(_result.toString().contains("score")){
     String Score = result["score"];
    }
  })
}).onError((error, stackTrace)=>{});
} on PlatformException {}

For gallery 2

 try{
   var accuraConfs = {
     "face1": this.facematchURI,
     "face2": this.facematchURI2
   };

   await OnlyForTrial.getGallery2([accuraConfs]).then((value) => {
     setState(() {
       dynamic result = json.decode(value);
       String facematchURI2 = result["Image"];
       if(result.toString().contains("score")){
        String Score = result["score"];
       }
     })
   }).onError((error, stackTrace)=>{});
 } on PlatformException {}

To Open Camera for Facematch 1 and 2:

For Facematch 1:

try{
 var accuraConfs = {
   "face1": this.facematchURI,
   "face2": this.facematchURI2
 };
 await OnlyForTrial.setFaceMatchFeedbackTextSize(18);
 await OnlyForTrial.setFaceMatchFeedBackframeMessage("Frame Your Face");
 await OnlyForTrial.setFaceMatchFeedBackAwayMessage("Move Phone Away");
 await OnlyForTrial.setFaceMatchFeedBackOpenEyesMessage("Keep Your Eyes Open");
 await OnlyForTrial.setFaceMatchFeedBackCloserMessage("Move Phone Closer");
 await OnlyForTrial.setFaceMatchFeedBackCenterMessage("Move Phone Center");
 await OnlyForTrial.setFaceMatchFeedbackMultipleFaceMessage("Multiple Face Detected");
 await OnlyForTrial.setFaceMatchFeedBackFaceSteadymessage("Keep Your Head Straight");
 await OnlyForTrial.setFaceMatchFeedBackLowLightMessage("Low light detected");
 await OnlyForTrial.setFaceMatchFeedBackBlurFaceMessage("Blur Detected Over Face");
 await OnlyForTrial.setFaceMatchFeedBackGlareFaceMessage("Glare Detected");
 await OnlyForTrial.setBlurPercentage(80);
 await OnlyForTrial.setFaceMatchGlarePercentage_0(-1);
 await OnlyForTrial.setFaceMatchGlarePercentage_1(-1);

 await OnlyForTrial.getCamera1([accuraConfs]).then((value) => {
   setState(() {
       dynamic result = json.decode(value);
       String facematchURI = result["Image"];
       if(result.toString().contains("score")){
        String Score = result["score"];
       }
     })
 });
} on PlatformException {}

For Facematch 2

try{
 var accuraConfs = {
   "face1": this.facematchURI,
   "face2": this.facematchURI2
 };
 await OnlyForTrial.setFaceMatchFeedbackTextSize(18);
 await OnlyForTrial.setFaceMatchFeedBackframeMessage("Frame Your Face");
 await OnlyForTrial.setFaceMatchFeedBackAwayMessage("Move Phone Away");
 await OnlyForTrial.setFaceMatchFeedBackOpenEyesMessage("Keep Your Eyes Open");
 await OnlyForTrial.setFaceMatchFeedBackCloserMessage("Move Phone Closer");
 await OnlyForTrial.setFaceMatchFeedBackCenterMessage("Move Phone Center");
 await OnlyForTrial.setFaceMatchFeedbackMultipleFaceMessage("Multiple Face Detected");
 await OnlyForTrial.setFaceMatchFeedBackFaceSteadymessage("Keep Your Head Straight");
 await OnlyForTrial.setFaceMatchFeedBackLowLightMessage("Low light detected");
 await OnlyForTrial.setFaceMatchFeedBackBlurFaceMessage("Blur Detected Over Face");
 await OnlyForTrial.setFaceMatchFeedBackGlareFaceMessage("Glare Detected");
 await OnlyForTrial.setBlurPercentage(80);
 await OnlyForTrial.setFaceMatchGlarePercentage_0(-1);
 await OnlyForTrial.setFaceMatchGlarePercentage_1(-1);

 await OnlyForTrial.getCamera2([accuraConfs]).then((value) => {
   setState(() {
       dynamic result = json.decode(value);
       String facematchURI2 = result["Image"];
       if(result.toString().contains("score")){
        String Score = result["score"];
       }
     })
 });//.onError((error, stackTrace)=>{print("Not Printing")});
} on PlatformException {}

accuraConfs: JSON Object

face1: 'uri of face1'

Face2: ’uri of face2’

Success: JSON Response {

Image: URI?,

score: String, }

Error: String

CountryModels:

type: JSON Array

contents: CardItems

properties:

id: integer

name: string

Cards: JSON Array

CardItems:

type: JSON Array

contents: JSON Objects

properties:

id: integer

name: string

type: integer

BarcodeItems:

type: JSON Array

properties:

name: string

Contributing See the contributing guide to learn how to contribute to the repository and the development workflow.

License: MIT

Libraries

only_for_trial