Giter Site home page Giter Site logo

Comments (14)

culoi avatar culoi commented on August 16, 2024 1

Hello @tuananhluong

Are you able to share your index.js file? You can send it on [email protected]

Regards

from blinkid-react-native.

culoi avatar culoi commented on August 16, 2024

Hello @tuananhluong ,

Can you please try to set index.js on following way:

        try {

            

            var malayIdRecognizer = new BlinkIDReactNative.MyKadFrontRecognizer();
            malayIdRecognizer.returnFaceImage = true;
            malayIdRecognizer.returnFullDocumentImage = true;

            var malayIdSuccessFrameGrabber = new BlinkIDReactNative.SuccessFrameGrabberRecognizer(malayIdRecognizer);

            const scanningResults = await BlinkIDReactNative.BlinkID.scanWithCamera(
                new BlinkIDReactNative.DocumentOverlaySettings(),
                new BlinkIDReactNative.RecognizerCollection([malayIdSuccessFrameGrabber]),
                licenseKey
            );

            if (scanningResults) {
                let newState = {
                    showImageDocument: false,
                    resultImageDocument: '',
                    showImageFace: false,
                    resultImageFace: '',
                    results: '',
                    showSuccessFrame: false,
                    successFrame: ''
                };

                for (let i = 0; i < scanningResults.length; ++i) {
                    let localState = this.handleResult(scanningResults[i]);
                    newState.showImageDocument = newState.showImageDocument || localState.showImageDocument;
                    if (localState.resultImageDocument) {
                        newState.resultImageDocument = localState.resultImageDocument;
                    }
                    newState.showImageFace = newState.showImageFace || localState.showImageFace;
                    if (localState.resultImageFace) {
                        newState.resultImageFace = localState.resultImageFace;
                    }
                    newState.results += localState.results;
                    newState.showSuccessFrame = newState.showSuccessFrame || localState.showSuccessFrame;
                    if (localState.successFrame) {
                        newState.successFrame = localState.successFrame;
                    }
                  
                }
                newState.results += '\n';
                this.setState(newState);
            }
        } catch (error) {
            console.log(error);
            this.setState({ showImageDocument: false, resultImageDocument: '', showImageFace: "", resultImageFace: '', results: 'Scanning has been cancelled', showSuccessFrame: false,
            successFrame: ''});
        }
    }

and handle results on following way:

        let fieldDelim = ";\n";
        
        var localState = {
            showImageDocument: false,
            resultImageDocument: '',
            showImageFace: '',
            resultImageFace: '',
            results: '',
            showSuccessFrame: false,
            successFrame: ''
        };
        
        if (result instanceof BlinkIDReactNative.MyKadFrontRecognizerResult) {

            localState.results +=
            "NRIC number:" + result.nricNumber + fieldDelim +
            "First name:" + result.ownerFullName + fieldDelim; 


            //add desired results from the https://github.com/BlinkID/blinkid-phonegap/blob/master/BlinkID/www/blinkIdScanner.js#L5772


        
        if (result.faceImage) {
                localState.showImageFace = true;
                localState.resultImageFace = 'data:image/jpg;base64,' + result.faceImage;
            }
        
        } else if (result instanceof BlinkIDReactNative.SuccessFrameGrabberRecognizerResult) {
            // first handle slave result, and then add success frame image
            localState = this.handleResult(result.slaveRecognizerResult);
  
              // success frame is returned as Base64 encoded JPEG
            if (result.successFrame) {
                localState.showSuccessFrame = true 
                localState.successFrame = 'data:image/jpg;base64,' + result.successFrame;
            }
        }
        return localState;
    }

Best regards,

Ivan

from blinkid-react-native.

tuananhluong avatar tuananhluong commented on August 16, 2024

Thank you @culoi

I follow your suggestion and the console log error as below:

TypeError: Cannot read property 'scanWithCamera' of undefined
    at BlinkIDWrapper.scanWithCamera$ (blob:http://localhost:8081/74af9f55-7f45-4643-9597-8b5ca9d9505a:62520:95)
    at tryCatch (blob:http://localhost:8081/74af9f55-7f45-4643-9597-8b5ca9d9505a:16727:19)
    at Generator.invoke [as _invoke] (blob:http://localhost:8081/74af9f55-7f45-4643-9597-8b5ca9d9505a:16900:24)
    at Generator.prototype.(anonymous function) [as next] (blob:http://localhost:8081/74af9f55-7f45-4643-9597-8b5ca9d9505a:16770:23)
    at tryCatch (blob:http://localhost:8081/74af9f55-7f45-4643-9597-8b5ca9d9505a:16727:19)
    at invoke (blob:http://localhost:8081/74af9f55-7f45-4643-9597-8b5ca9d9505a:16803:22)
    at blob:http://localhost:8081/74af9f55-7f45-4643-9597-8b5ca9d9505a:16831:13
    at tryCallTwo (blob:http://localhost:8081/74af9f55-7f45-4643-9597-8b5ca9d9505a:16065:7)
    at doResolve (blob:http://localhost:8081/74af9f55-7f45-4643-9597-8b5ca9d9505a:16229:15)
    at new Promise (blob:http://localhost:8081/74af9f55-7f45-4643-9597-8b5ca9d9505a:16088:5)

from blinkid-react-native.

tuananhluong avatar tuananhluong commented on August 16, 2024

Hi @culoi
I sent email to [email protected] with my source code.
Thank you so much.

Best regards,
Tuan

from blinkid-react-native.

yangy46 avatar yangy46 commented on August 16, 2024

@tuananhluong were you ever able to resolve this on your side? I'm running into the same issue.

from blinkid-react-native.

i1E avatar i1E commented on August 16, 2024

Hi @tuananhluong,

does our sample app work for you? It can be created by running initReactNativeDemoApp.sh.

from blinkid-react-native.

jacky-ew avatar jacky-ew commented on August 16, 2024

running into same issue, android 10.

also if its test run on react native 0.60 or above, why do we still need perform linking, 0.60 already provide auto linking

from blinkid-react-native.

jacky-ew avatar jacky-ew commented on August 16, 2024

the script and demo video only shows for ios, how to install demo app for android

from blinkid-react-native.

jacky-ew avatar jacky-ew commented on August 16, 2024

my previous experience with such error is that the native modules are not linked properly in MainApplication.java.
However in this doc, cant find any guide to import proper package to be added in react's package list. please help troubleshoot this issue.

on the current project, running linking shows error. probably bcz the proj is running on 0.61.2

from blinkid-react-native.

i1E avatar i1E commented on August 16, 2024

Hi @jacky-ew,

Our plugin works with React Native v0.61.5.

The initReactNativeDemoApp.sh creates sample project for Android and iOS. Also, in that script you can see commands for adding the plugin to your application. Video shows instructions for iOS and Android, Android part starts at 02:23.

To test our plugin run the script and sample app:

// run scritp to create sample project
./initReactNativeDemoApp.sh
// position to created sample project
cd BlinkIDReactNative
// run the app
react-native run-android

Does the sample app work for you?

from blinkid-react-native.

i1E avatar i1E commented on August 16, 2024

Hi @jacky-ew,

also, when including plugin to your application, don't forget to add Microblink maven repository to project level build.gradle: https://github.com/BlinkID/blinkid-react-native#android

from blinkid-react-native.

mparadina avatar mparadina commented on August 16, 2024

Hi @jacky-ew

As this issue is inactive, I am closing it.
However, if this is still an open issue for you, feel free to re-open this one or create a new issue.

Also, you can always contact us directly at [email protected] for any additional questions.

Regards,
Milan

from blinkid-react-native.

jacky-ew avatar jacky-ew commented on August 16, 2024

Hi sorry for the late update, im no longer facing the issue,
i added the maven at wrong line in gradle file

from blinkid-react-native.

mparadina avatar mparadina commented on August 16, 2024

Hi @jacky-ew

Thank you for the feedback.
We are glad to hear that your issue has been resolved.

Since you fixed the issue, I am closing it.

Regards,
Milan

from blinkid-react-native.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.