4

I want portrait orientation for my application, I tryed with:

AndroidManifest.xml:

<activity ... android:screenOrientation="portrait" ... android:configChanges="orientation| ..." />

and config.xml:

<preference name="orientation" value="portrait" />

That works perfectly on my android phone, but not on iPhone 4.

Thanks!

Enacefio
  • 183
  • 2
  • 8

4 Answers4

9

Open 'ProjectName'-info.plist file in Xcode.

In 'Supported interface orientations' array, keep support for Portrait mode only.

Like this-

enter image description here

then your phonegap app will run only in Portait Mode on iPhone.

Community
  • 1
  • 1
Mayur Birari
  • 5,837
  • 8
  • 34
  • 61
  • 1
    I'm programming on windows :( I don't have a mac computer. But maybe i will borrow some for do that. Thanks anyway, think that is the only solution. – Enacefio Feb 14 '13 at 13:04
  • though you have Windows machine, You can still modify plist file, it is xml format file – Mayur Birari Feb 14 '13 at 13:08
  • I havnt't any .plist file on my project :S – Enacefio Feb 14 '13 at 13:14
  • The plist files will not even be generated on windows because PhoneGap doesn't have the libraries to create xcode projects.. Thats why this didn't work. – Hless Oct 07 '13 at 14:38
1

For iphone, you have to developp with xcode. Just create a new phonegap project and on xcode clic on your project, go in Summary and just select the orientation you want to support portrait in xcode

And that all you have to do

Hope this help you

Community
  • 1
  • 1
dpfauwadel
  • 3,866
  • 3
  • 23
  • 40
0

Hmm, if you want to use only javascript and PhoneGap to do this, this link would be helpful. If you're using Xcode then you can go to supported device orientations and choose the desired orientation and then use shouldautorotatetointerfaceorientation method to set the desired orientation. You might also want to look into this.

Community
  • 1
  • 1
esh
  • 2,842
  • 5
  • 23
  • 39
  • Thanks, but I'm using only javascript and I dont want to detect when i change the orientationt. I want to disable the landscape view. But thanks I think that I'll have to remake the code for adapt the content to landscape. – Enacefio Feb 14 '13 at 13:02
0

I found that the first line in the latest phonegap worked for me.

android:screenOrientation="portrait"

Of course that's not going to help with your iPhone problem but it does mean that your next Android app will be a few bytes smaller…

Flowdeeps
  • 21
  • 3