Problem Description
I'm having an issue with the Ti.Barcode module where when the device is rotated the barcode scanning screen rotates also, even though device orientation is set to Ti.UI.PORTRAIT in the tiapp.xml file
TESTING ENVIRONMENT
Ti CLI 3.3.0
Titanium SDK: 3.3.0.GA and 3.2.X.GA
iPhone and iPad Device
TEST CODE
var Barcode = require('ti.barcode');
Barcode.allowRotation = true;
Barcode.displayedMessage = '';
Barcode.useLED = true;
var window = Ti.UI.createWindow({
backgroundColor : 'white'
});
var scrollView = Ti.UI.createScrollView({
contentWidth : 'auto',
contentHeight : 'auto',
top : 0,
showVerticalScrollIndicator : true,
layout : 'vertical'
});
var scanCode = Ti.UI.createButton({
title : 'Scan Code',
width : 200,
height : 60,
top : 20
});
scanCode.addEventListener('click', function() {
Barcode.capture({
animate : true,
showCancel : false,
showRectangle : false,
keepOpen : true
});
});
scrollView.add(scanCode);
window.add(scrollView);
window.open();
~~~~~~~~~~~~~~~~~~
<iphone>
<orientations device="iphone">
<orientation>Ti.UI.PORTRAIT</orientation>
</orientations>
<orientations device="ipad">
<orientation>Ti.UI.PORTRAIT</orientation>
</orientations>
</iphone>
<modules>
<module platform="iphone">ti.barcode</module>
</modules>
~~~~~~~~~~~
STEP TO TEST
- Create a new project
- Update "app.js" file with "app.js" code segment given above.
- Download the barcode module zip file [ti.barcode-iphone-1.8.3.zip](
https://github.com/appcelerator/titanium_modules/blob/master/barcode/mobile/ios/ti.barcode-iphone-1.8.3.zip?raw=true)
- Extract the zip file, copy the module folder to your app
- Include "tiapp.xml" code segment given above to the "tiapp.xml" file
- Run the app in iPhone or iPad device.
- Touch "scan Code" to see the barcode scanning screen
- Rotate the device and see problem
OBSERVED RESULT
Rotating the device is causing the rotation of barcode scanning screen, even though the orientation was fixed to portrait.
Any updates here? It's been over 2 weeks with no reply.
Thanks for your report! The MOD team will set the priority here.
It looks like this issue is in the ZXing lib and may be solved by updating to the latest version via TIMODOPEN-219
Anybody knows how solve this problem? I have it too.
Hello, I found a correction for this problem : http://exygy.com/how-to-modify-ti-barcode-to-correct-two-annoying-behaviors-in-ios-and-android/ If it can be help ! Regards.
This rotation issue has a very good chance at being a problem that exists and needs to be solved within the glue between the lib and titanium vs being something that is solved just by an upgrade to the lib version. Jon Alter, what is your source / reference for your comment about thinking it is a problem with the ZXing lib so we can better understand this?
I can confirm that this problem still exists with the latest version, 1.9.1. In addition, I noticed three other, even more severe issues: 1) When an overlay is not specified, the camera preview comes solid black the first time the app is started. If I put the app into the background and immediately bring it back up, the camera preview works as expected. 2) Overlay touch events and orientation change events are only processed when there is a barcode in front of the camera. This means that the buttons on the overlay as well as the overlay orientation seem to be frozen until a barcode comes into focus of the camera, at which point they are retroactively processed. 3) When the camera preview and overlay are rotated into landscape mode, their dimensions don't update to landscape mode so part of the screen will be black and part of the overlay will be off screen. I am not sure if these are all new problems; you can see problem #3 in the screenshots attached to the description back in June so obviously that's not a new problem. Considering these problems, it seems to me fixing just the rotation issue is not going to make this module useable. Are we being asked to fix all these problems? If so, I would like to update the description of this JIRA ticket, or perhaps other one, MOD-1998, to make this objective clear. Also, with regards to problem #3, is disabling orientation changes altogether an acceptable solution, or do we expect the module to support landscape orientation depending on configuration?
[~egomez], [~rblalock] Please review Zsombor's comments made on the 24th of Feb and provide your response along with direction, expectations and priority.
Hello!, [~cng], I have tested that module and getting the same behaviour as like [~zpapp] (previous comment). My testing env: Appc CLI 5.2.2 Module Version: 1.9.1 Titanium SDK: 5.2.2.GA iPhone device version: v 9.3.2 Any updates or workaround for this issue?
[~vijaysingh] Ti.Barcode was revived from the archive, do you want to take a look into this issue? Looks *very* related to the camera overlay issue on Ti.Media recently, so a quick fix. Thanks!
I tried with latest ti.barcode (1.10.0) module. It is working fine to me . [~ewieber] Can you please verify once and let me know , if issue is still reproducible at your end. Thanks.
I am able to reproduce it with latest master (1.10.0), see the [attached example](https://www.dropbox.com/s/cs08b3xhabmivqz/test_barcode.zip?dl=1) project for details.
PR: https://github.com/appcelerator-modules/ti.barcode/pull/53 Test Case :
[~vijaysingh] Please also draft the new release 1.10.1 on Github.
In addition to above PR there is minor fix for build in PR - https://github.com/appcelerator-modules/ti.barcode/pull/54 [~hknoechel] Can you please review the same. Thanks.
Cleaning up older fixed issues. If this issue should not have been closed as fixed, please reopen.