BarcodeScanner icon indicating copy to clipboard operation
BarcodeScanner copied to clipboard

Portrait mode on Android

Open Marus opened this issue 11 years ago • 26 comments

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.

Marus avatar Dec 02 '13 12:12 Marus

同问

codeachange avatar Jan 22 '14 14:01 codeachange

can we figure out a solution for this one?

voltsonic avatar Jan 28 '14 18:01 voltsonic

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.

jough avatar Feb 07 '14 15:02 jough

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.

Marus avatar Feb 07 '14 15:02 Marus

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

Parmee avatar Mar 12 '14 00:03 Parmee

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!

Dbuggerx avatar Mar 12 '14 00:03 Dbuggerx

I'm seeing the same issue. Trying to set it to portrait in AndroidManifest causes all sorts of display problems.

perrygovier avatar Apr 02 '14 15:04 perrygovier

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 .

Dbuggerx avatar Apr 02 '14 15:04 Dbuggerx

This was perfect, thanks!

perrygovier avatar Apr 25 '14 14:04 perrygovier

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.

sreekm avatar May 06 '14 08:05 sreekm

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?

GTGeek88 avatar Aug 15 '14 20:08 GTGeek88

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. :)

backblade avatar Sep 07 '14 06:09 backblade

Any progress on submitting this to PhoneGap Build?

rudza avatar Nov 20 '14 16:11 rudza

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 avatar May 13 '15 22:05 nickrouty

@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).

Dbuggerx avatar May 14 '15 06:05 Dbuggerx

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.

ycanales avatar May 19 '15 02:05 ycanales

@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!

nickrouty avatar May 19 '15 02:05 nickrouty

+1 for this, taking a look in to the fork in the meantime.

Dr-Steve avatar Jul 31 '15 18:07 Dr-Steve

have you guys got this to work? I tried changing it myself and it made soo many problems

Ross-Rawlins avatar Aug 12 '15 11:08 Ross-Rawlins

@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

Dr-Steve avatar Aug 17 '15 18:08 Dr-Steve

but is it by default set to portrait?

Ross-Rawlins avatar Aug 18 '15 06:08 Ross-Rawlins

Yes, if you get that fork working then it will open in portrait mode.

Dr-Steve avatar Aug 18 '15 11:08 Dr-Steve

Thanks this made my life soo much easier on an app I am bulding

Ross-Rawlins avatar Aug 18 '15 13:08 Ross-Rawlins

@Dbuggerx is the real hero here.

Dr-Steve avatar Aug 18 '15 13:08 Dr-Steve

@Dbuggerx get that man a bells!

Ross-Rawlins avatar Aug 18 '15 13:08 Ross-Rawlins

+1 I want this!

vcajes avatar Mar 23 '16 11:03 vcajes