Prevent landscape orientation in Android?
I have an Android app that I'd like to stay in portrait only, but so far nothing I've tried is working.
What I've tried so far:
When creating the window in app.js specify in the orientationModes property that only portrait is valid (works on iPhone).
Create a custom AndroidManifest.xml file (using instructions here)
Anyone have any luck keeping an Android app in a particular orientation and ignoring the device being rotated?
Thanks!
6 Answers
-
Accepted Answer
Couple items:
android:screenOrientation is case-sensitive, so you can try that…
We have an issue in Lighthouse that work on this issue will go under.
-
Anyone have any thoughts on this?
-
so this isn't working at them moment? can somebody of appcelerator devs confirm this? this would be a major showstopper to the app i'm currently working on!!
-
The same goes for me, My apps look horrible when autoscaled.
-
Have a little more info on this. Deleted the Android Virtual Device I was using and let Ti create a new one when launching my app. When I create the AndroidManifest.custom.xml file and add android:ScreenOrientation="portrait" to each of the activity sections, now when I try to run my app it fails to compile and I see this in Developer:
[ERROR] /Developer/android-sdk-mac/platforms/android-4/tools/aapt /Users/dgiul/Documents/projects/mobile/Hoptopia Android/Hoptopia/build/android/AndroidManifest.xml:21: error: No resource identifier found for attribute 'ScreenOrientation' in package 'android'
[ERROR] Error generating R.java from manifest -
Ahhh, there we go. Changed the case of the command in the custom manifest file and it now works in the emulator and on the device.
Thanks!