Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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!

— asked June 21st 2010 by Dan Giulvezan
  • android
  • landscape
  • mobile
  • orientation
  • portrait
  • rotation
0 Comments

6 Answers

  • Anyone have any thoughts on this?

    — answered June 23rd 2010 by Dan Giulvezan
    permalink
    0 Comments
  • 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!!

    — answered June 23rd 2010 by Christian Sigl
    permalink
    0 Comments
  • The same goes for me, My apps look horrible when autoscaled.

    — answered June 23rd 2010 by Ryan Tregea
    permalink
    0 Comments
  • 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

    — answered June 23rd 2010 by Dan Giulvezan
    permalink
    0 Comments
  • 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!

    — answered June 23rd 2010 by Dan Giulvezan
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.