Scanner orientation lock


#1

Hi,
I am successful to lock the screen before scanning, but after scanner opens, orientation changes!
What is the solution for that issue.

ionic 3/ iPhone only.
the problem is resolved in Android by adding:
orientation : “portrait”, // Android only (portrait|landscape), default unset so it rotates with the device
Best


#2

What “scanner” are you talking about?


#3

It is the Cordova plugin for scanning barcodes, using device camera.
last version.


#4

I sure won’t go through the 27 plugins that allow barcode scanning in Cordova to find out which one you maybe meant. Please provide more information.


#5

Here it is:
<plugin name="phonegap-plugin-barcodescanner" spec="^7.0.2">

here how I use it:

this.options = {
      prompt : "Scan the Barcode. ",
      orientation : "portrait",
    }
    this.barcodeScanner.scan(this.options).then((barcodeData) => {
        this.getVinInfo(barcodeData.text);
        this.scanData = barcodeData;
    }, (err) => {
        console.log(`Error: item_create::scanVin! ${err}` );
    });     
  }

this: orientation : “portrait”, is working for android but not for iPhone.
So can not lock the camera(scanner) orientation.
Thanks


#6

From the documentation of said plugin:

      orientation : "landscape", // Android only (portrait|landscape), default unset so it rotates with the device

Note the “Android only”

Source: https://github.com/phonegap/phonegap-plugin-barcodescanner


#7

yes this is what I mentioned in my original post, Now i need a solution. to lock it in iPhone as well.