@nagubabu wrote:
I am developing an ionic application (Android) using phonegap-plugin-barcodescanner plugin version 4.0.1. In my controller when I click Scan button the barcode scanner should open in landscape mode only. Below is my ionic info and controller code snippet.
Cordova CLI: 6.4.0
Ionic Framework Version: 1.3.2
Ionic CLI Version: 2.1.4
Ionic App Lib Version: 2.1.2
OS: Windows 8.1
Node Version: v6.4.0.controller('scanCtrl', function ($scope, $rootScope, $cordovaBarcodeScanner) { $rootScope.$on('$locationChangeSuccess', function (event, newUrl, oldUrl) { screen.lockOrientation("landscape"); /* $cordovaBarcodeScanner.scan().then(function (imageData) { console.log("Barcode Format -> " + imageData.format); console.log("Cancelled -> " + imageData.cancelled); }, function (error) { console.log("An error happened -> " + error); }); */ }); })
When I put comments for the code block $cordovaBarcodeScanner.scan() the screen orientation is changing to landscape mode, but when I remove the comments it's opening in portrait mode not in landscape mode as I expected.
Please help me to open the barcode scanner in landscape mode only.
Even I tried adding android:screenOrientation="landscape" to the barcode scanner plugin's config.xml file as well. But no luck. Please help me to solve this issue. Any help would be appreciated. Thanks in advance.
Posts: 1
Participants: 1