This is a migrated thread and some comments may be shown as answers.

BarcodeScanner Plugin - Specify Screen Orientation

9 Answers 493 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bill
Top achievements
Rank 1
Bill asked on 27 Mar 2015, 07:07 PM
I updated our BarcodeScanner plugin today and discovered that the camera/scanner now auto rotates its orientation. This is a game breaker for situations when you can't rotate a barcode. Think of a car door where the VIN barcode is vertical...

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

Sort by
0
Kaloyan
Telerik team
answered on 01 Apr 2015, 12:50 PM
Hi Bill,

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.

 
0
Accepted
Kaloyan
Telerik team
answered on 07 Apr 2015, 11:20 AM
Hi again Bill,

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:
  1. Download the content in the above mentioned git repo as an archive.
  2. Import it in your project, under the Plugins folder.
  3. 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).
  4. In AppBuilder, navigate to the newly imported BarcodeScanner plugin's plugin.xml file. You should see it under: Plugins/BarcodeScanner-master/plugin.xml.
  5. 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>
This will lock the BarcodeScanner's orientation to landscape. I hope it 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.

 
0
Bill
Top achievements
Rank 1
answered on 05 Jun 2015, 07:57 PM

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.

0
Kaloyan
Telerik team
answered on 10 Jun 2015, 11:54 AM
Hello Bill,

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.

 
0
Amir
Top achievements
Rank 1
answered on 04 Aug 2015, 06:03 PM

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. 

 

 

0
Tina Stancheva
Telerik team
answered on 07 Aug 2015, 10:42 AM
Hi Amir,

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.

 
0
Amir
Top achievements
Rank 1
answered on 09 Aug 2015, 05:25 PM

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

 

Regards

Amir Gill

0
Sam
Top achievements
Rank 1
answered on 30 Sep 2015, 09:24 AM
Hi, I am trying to lock my orientation to portrait during scan. My xamarin.android project has no plugins folder so i added it and added the plugins file from Github. The folder is showing up black in solution explorer so its not included in The project?? any ideas???
0
Tina Stancheva
Telerik team
answered on 05 Oct 2015, 12:40 PM
Hi Sam,

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.

 
Tags
General Discussion
Asked by
Bill
Top achievements
Rank 1
Answers by
Kaloyan
Telerik team
Bill
Top achievements
Rank 1
Amir
Top achievements
Rank 1
Tina Stancheva
Telerik team
Sam
Top achievements
Rank 1
Share this question
or