Skip to content
This repository has been archived by the owner on Oct 10, 2020. It is now read-only.

Option to disable or lock rotation while camera is showing #56

Closed
firsthour opened this issue Nov 9, 2018 · 2 comments
Closed

Option to disable or lock rotation while camera is showing #56

firsthour opened this issue Nov 9, 2018 · 2 comments

Comments

@firsthour
Copy link

firsthour commented Nov 9, 2018

Our users will be scanning quite a few vertical mounted barcode stickers, and while testing our app out on location the other day I had to lock screen rotation of my Android phone at the OS level because I was unable to scan a barcode without the screen constantly rotating.

Is it possible to lock rotation of just the camera scanning? I would prefer to allow the user to use both landscape or portrait while using the app regularly.

For what it's worth I tried the following code on the screen that launched the scanning and while it locked that screen's orientation, it did not affect the camera itself:

SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, DeviceOrientation.portraitDown, ]);

@firsthour
Copy link
Author

Solved it pretty easy for Android, edited the AndroidManifest:

<activity android:name="com.apptreesoftware.barcodescan.BarcodeScannerActivity" android:screenOrientation="portrait" />

I am completely unfamiliar with IOS, is there a similar solution? I honestly don't even know if it will be an issue.

@devtronic
Copy link
Member

You can specify the orientation in Xcode (Select the Target -> General -> Deployment Info -> Device Orientation)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants