Pablo R.
Pablo R.

Reputation: 723

Ionic Barcode Scanner not to hide when scan is success

I am trying to implement a QR Scanner using native's ionic barcode-scanner.

https://ionicframework.com/docs/native/barcode-scanner/

I would like to scan a QR and stay in the Scanner view showing a modal on top of the camera overlay.

  ionViewDidLoad() {
    this.scan()
  }


  scan(){
    this.barcodeScanner.scan(this.options).then(barcodeData => {
      this.scannedData = barcodeData;
      this.modal.create("ScannerResultPage").present();
      console.log('Barcode data', barcodeData);
     }).catch(err => {
         console.log('Error', err);
     });
  }

Is it possible to achieve this?

Upvotes: 0

Views: 983

Answers (1)

user9168386
user9168386

Reputation:

You cant do this unless you tweak the native code from ionic barcode scanner.

Anyways you could do it with QuaggaJS (which obviously is the better choice instead of tweaking an NPM Module)

It works with Web and Mobile (so with Ionic too). I used it in some of my projects and it worked well BUT not with Native iOS because Native iOS Safari doesnt support GetUserMedia API (you can check the supported browsers here) which is needed for QuaggaJS in order to work properly. On Android, Mobile Browser, Desktop and Desktop Browser it works perfect.

Upvotes: 1

Related Questions