BarcodeScanner
BarcodeScanner copied to clipboard
Portrait mode on Android
Hi,
I''m just wondering if it is possible to use the barcode scanning plugin in portrait mode on Android? Seems like a strange restriction to have it limited to landscape when the majority of UIs for phone applications are portrait primarily, and from a user experience point of view it isn't very nice to have to constantly switch between portrait and landscape.
同问
can we figure out a solution for this one?
I'll +1 this one if it helps prioritize this. It'd be nice to be able to choose portrait or landscape, but if the plugin can only do one, it should default to portrait considering the position of the camera on most phones and the shape of the human hand.
I've managed to make it work in portrait mode through some customizations of the code myself (only portrait though; haven't put in enough effort for it to support rotation). I haven't gone through the effort of figuring out how to rebuild the jar and update the plugin so that it can be installed nicely though; currently I've manually included in my project as a LibraryProject reference instead of a jar file and manually updated the various XML files.
I'll try to get a chance in the next day or so to push up my code to a repository; but you would still have to do a manual install like I have.
I am currently using this feature on Phonegap Build - and whilst it works portrait on iPhone, having landscape on android is a bit puzzling. Our app is portrait only, and so having android portrait too would be a huge benefit.
Thanks
Hi @Parmee, I agree with you (although I haven't tried the scanner on iOS yet). I read about it, and based on my findings, I came up with a forked portrait version: https://github.com/Dbuggerx/BarcodeScanner.git Give it a try and let me know if it works for you!
I'm seeing the same issue. Trying to set it to portrait in AndroidManifest causes all sorts of display problems.
Hey Perry, I already implemented it in: https://github.com/Dbuggerx/BarcodeScanner Give it a try and let me know if it works for you. On Apr 2, 2014 12:47 PM, "Perry Govier" [email protected] wrote:
I'm seeing the same issue. Trying to set it to portrait in AndroidManifest causes all sorts of display problems.
Reply to this email directly or view it on GitHubhttps://github.com/wildabeast/BarcodeScanner/issues/70#issuecomment-39346877 .
This was perfect, thanks!
Hi @Dbuggerx , I am new to phonegap.Can you tell me how can i create a plugin after editing the zxing barcode scanner source code. My requirement is to make a fullscreen scanner in portrait mode.
Yeah, this needs to be fixed. Under iOS, it's great. Works in portrait mode and has a nice large area to get the barcode into. Under Android, it's not so great. Landscape only and has a very small area in which to work. So it's just harder to work with from two different standpoints. As for the scan area size, maybe it was designed for the small screen of a phone and will not resize the scanning area for a tablet?
Hi @Dbuggerx,
Could we submit your fork to phonegap build? (http://build.phonegap.com/) At least, folks could build projects with a QR code reader on Android that is in portrait mode. :)
Any progress on submitting this to PhoneGap Build?
Seems like a shame that a new plugin was started to address this -- why not submit a pull request? Ionic uses this version within the ngCordova setup. Be nice to just have this plugin 'fixed' for android.
UPDATE: I stand corrected, the @Dbuggerx version is the same API calls as well. Worked great with ngCordova lib. Simply use their implementation instead.
cordova plugin add https://github.com/Dbuggerx/BarcodeScanner
@nickrouty My apologies...I've been busy with other personal projects since I implemented the "portrait mode". Is it still relevant to submit a pull request to this repository? (I guess so, since you've pointed out that ngCordova still uses it) If so, I guess I can find some time to update my code, rebase my changes and submit a PR (maybe even submit it to phonegap).
Found this fork, it's recent and forked from the new official repo, it allows for portrait and landscape and the area is larger too.
Tested it and works fine in Android / Nexus 5.
@Dbuggerx No apologies needed. Not sure if @wildabeast is continuing to maintain the project or not - if so, a pull request would be good as I'm sure most people find this project first before finding updated versions. Yours worked great, thanks for your work!
+1 for this, taking a look in to the fork in the meantime.
have you guys got this to work? I tried changing it myself and it made soo many problems
@Duovili I got Dbuggerx's fork to work at https://github.com/Dbuggerx/BarcodeScanner
I am using angular with cordova. I first had to remove my platforms so that changes in the plugin directory would propagate down to the devices:
cordova platforms remove android
I then removed the old plugin that was installed by doing a
cd plugins
rm -rf com.phonegap.plugins.barcodescanner
And then cloned his fork into the plugin directory with
git clone https://github.com/Dbuggerx/BarcodeScanner.git
I then renamed the clone dir to match the old plugin:
mv BarcodeScanner com.phonegap.plugins.barcodescanner
I think that I also had to install it from that directory:
cordova plugin install ./com.phonegap.plugins.barcodescanner
I then re-added all of my platforms, and it worked. Note that your process may be a bit different, depending on your directory structure and whatnot. Some people here clain that you can get by without removing your platforms and re-adding them using the command cordova prepare android
, but that did not work for me. Also note that your config may be different depending on how you had originally installed your plugin. modifying fetch.json to have something like this may help:
"com.phonegap.plugins.barcodescanner": {
"source": {
"type": "local",
"path": "https://github.com/Dbuggerx/BarcodeScanner.git"
}
Also you may find it easier to remove your old plugin then install using the link:
cordova plugin install https://github.com/Dbuggerx/BarcodeScanner.git
but is it by default set to portrait?
Yes, if you get that fork working then it will open in portrait mode.
Thanks this made my life soo much easier on an app I am bulding
@Dbuggerx is the real hero here.
@Dbuggerx get that man a bells!
+1 I want this!