ti.barcode icon indicating copy to clipboard operation
ti.barcode copied to clipboard

[Android]Orientation change not working

Open Max87ZA opened this issue 6 years ago • 5 comments

Hi guys, I have this module in Android app and when I launch scanner in portrait mode and rotate screen to landscape, scanner remains in portrait. Barcode.allowRotation = true not helped, UI stays in portrait mode. Is there any quick way to fix it? Thanks

Max87ZA avatar Oct 22 '18 14:10 Max87ZA

Check the modules/android/ti.barcode/4.0.0/timodule.xml and see if it works when you add android:screenOrientation="sensor" to the com.google.zxing.client.android.CaptureActivity activity. Normally there shouldn't be any screenOrientation so it should be The system chooses the orientation. Depending on what your app orientation is that might be locked there

m1ga avatar Oct 22 '18 17:10 m1ga

Hi Michael, I tried to edit that file, but no change, scanner doesn't rotate at all. Do I need to recompile module from source code? Thanks

Max87ZA avatar Oct 22 '18 22:10 Max87ZA

No, you don't need to recompile your module. The XML is merged into your tiapp.xml. Is your app orientation locked (tss, tiapp.xml)?

m1ga avatar Oct 23 '18 06:10 m1ga

No, my app changes orientation based on device sensors. Think is, if I rotate device before I launch Barcode scanner, it launches in landscape. But if I rotate to portrait in scanner's view, it doesn't do anything - I have to go back to main screen, change orientation and then launch scanner...

Max87ZA avatar Oct 23 '18 06:10 Max87ZA

added preventRotation to https://github.com/appcelerator-modules/ti.barcode/pull/89 setting it to false allows rotation the screen.

m1ga avatar Oct 26 '18 19:10 m1ga