Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable auto-rotate in Jquery Mobile or PhoneGap

Although cross platform development for mobile devices is so good. There isn't a simple option to disable auto-rotate or lock into one orientation i.e. portrait or landscape.

Is there anyway either in Jquery Mobile, PhoneGap, XUI anywhere ?

If yes then please help. Its driving me nuts.

like image 629
Mustafa Hanif Avatar asked May 19 '11 00:05

Mustafa Hanif


2 Answers

To complete the answer above.

On iPhone add this to -info.plist:

<dict>
`.....
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
    </array>
..........
</dict>

on Android to AndroidManifest.xml

<activity   ........      android:screenOrientation="portrait">
like image 166
David Dehghan Avatar answered Nov 16 '22 10:11

David Dehghan


For iOS, edit the PhoneGap.plist file (e.g. in Xcode). Make sure only portrait is set and uncheck autorotate.

On Android, you need to edit AndroidManifest.xml. Add android:screenOrientation="portrait" in the activity.

like image 5
dave1010 Avatar answered Nov 16 '22 10:11

dave1010