Does anyone know of a parameter or setting that can be used to lock in the current orientation or specify one?
9 Answers, 1 is accepted
Thank you for contacting us about the matter. Indeed, since version 1.2.4, the Barcode Scanner plugin supports both landscape and portrait orientations in Android. However, the view rotates automatically and at this stage, there is no way to prevent this out of the box. I have escalated this to the Telerik Verified Plugins Marketplace team. I believe a solution will be developed soon.
Until then, the only possible solution will be to use an older version of the Barcode Scanner plugin. As said above, the change is introduced for the first time in version 1.2.4. This means that, you should be able to still use any of the prior versions.
I hope this helps.
Regards,
Kaloyan
Telerik
Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.
I am happy to say that our engineers are working on a permanent fix that should expose a way to enable/disable the auto rotation programmatically. Still, until the fix is released, here is another possible workaround if you wish to benefit from the latest BarcodeScanner plugin version:
- Download the content in the above mentioned git repo as an archive.
- Import it in your project, under the Plugins folder.
- Open your project's properties and disable the default BarcodeScanner plugin. You should notice that there are two included now (one of them can't be disabled from the project's properties window).
- In AppBuilder, navigate to the newly imported BarcodeScanner plugin's plugin.xml file. You should see it under: Plugins/BarcodeScanner-master/plugin.xml.
- Add the following line in it:
<
config-file
target
=
"AndroidManifest.xml"
parent
=
"/manifest/application"
>
<
activity
android:name
=
"com.google.zxing.client.android.CaptureActivity"
android:clearTaskOnLaunch
=
"true"
android:screenOrientation
=
"landscape"
android:configChanges
=
"orientation|keyboardHidden"
android:theme
=
"@android:style/Theme.NoTitleBar.Fullscreen"
android:windowSoftInputMode
=
"stateAlwaysHidden"
android:exported
=
"false"
>
<
intent-filter
>
<
action
android:name
=
"com.phonegap.plugins.barcodescanner.SCAN"
/>
<
category
android:name
=
"android.intent.category.DEFAULT"
/>
</
intent-filter
>
</
activity
>
Regards,
Kaloyan
Telerik
Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

Kaloyan, thanks for the work around. Setting the screen orientation in the plugin.xml file works.
Unfortunately, the newer versions of the barcode scanner has the scanning window is so small that CODE_128 barcodes for vehicle VINs no longer work (at least on my test device it doesn't: LG G3).
Are there any options to increase the scan window? I'm guessing that is the problem... See screenshot.
I just tested this on Samsung Note 4 and you are absolutely correct that the scanning windows is too small. I ran the sample BarcodeScanner app with the latest (1.2.9) version of the plugin. The issue comes from this commit to the BarcodeScanner 1.2.4 version. The MAX_FRAME_WIDTH and MAX_FRAME_HEIGHT properties are changed there. This means that, with prior to the 1.2.4 version of the BarcodeScanner plugin, the issue should not be present. However, I will escalate the matter to our development team in order for a fix to be applied as soon as possible. Meanwhile, what I can suggest is to change the MAX_FRAME_WIDTH and MAX_FRAME_HEIGHT properties, as described here. Note that, you will have to re-build the zxing library for the changes to take effect.
I hope this helps.
Regards,
Kaloyan
Telerik
Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

Hey i am stuck with the same problem in the ios?
So do u have nay fix for iphone/ipad.
I tried adding changes to the config file
<preference name="Orientation" value="lanscape"/>
but this does not work. also in xcode (general tab i changed it to the same). The issue is when i open the barcodescanner it rotate as we changed the orientation.
Please reply.
I wasn't able to replicate this issue with the sample app available in the Plugin Marketplace. Can you please give it a try on your side and if the issue can be replicated, let me know the steps I should follow.
I tested the sample app on an iPad running iOS 7.0.4 and an iPad Mini running iOS 7.1.1. If the sample app doesn't replicate the issue on your side, please send over a sample app that does so I can further investigate the reported behavior.
Regards,
Tina Stancheva
Telerik
Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

Thanks Tina for the reply. Well i fixed the orientation issue in the native code.
Regards
Amir Gill

The BarcodeScanner plugin discussed in this forum thread is a Cordova plugin and the Plugins folder is part of an AppBuilder project structure. Can you please confirm whether you're using AppBuilder to develop your project? If you are, then the Plugins folder should be available in the project template out-of-the-box for you.
Regards,
Tina Stancheva
Telerik
Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.