android - Ionic Qr scan tutorial -


i trying scan qr code using phonegap-plugin-qrscanner. follow tutorial steps but, camera not open in device.

it code:

constructor(private qrscanner: qrscanner) {}  this.qrscanner.prepare()     .then((status: qrscannerstatus) => {       console.log('qrscanstatus status:');       console.log(status);       if(status.authorized) {                // start scanning         let scansub = this.qrscanner.scan().subscribe((text: string) => {          console.log('scanned something', text);           this.qrscanner.hide(); // hide camera preview          scansub.unsubscribe(); // stop scanning        });         this.qrscanner.show();       }else if(status.denied) {         console.log('status denied ...');       }else{         console.log('otro estado ...');       }     })     .catch((e) => {       console.log('error atrapado: ', e);     }); 

any ideas ?

seems trying use api of plugin, namely cordova-plugin-qrscanner

so suggestion either, place code in function , install cordova-plugin-qrscanner:

$ ionic cordova plugin add cordova-plugin-qrscanner $ npm install --save @ionic-native/qr-scanner 

or take @ documentation phonegap-plugin-barcodescanner , change code accordingly.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -