Phonegap 3.0.0 Lock Orientation

I am working on a game in PhoneGap. My game requires the screen to be "locked" in landscape mode. I need it to be locked so that you cannot turn on the device in a different landscape mode by rotating the screen (therefore, no matter how the device rotates, the screen does not change orientation. It will remain the same as it was before). I tried looking at this question , but it did not work for me. I need a solution that I can use easily, and preferably with Android and iOS. I use tools for PhoneGap, so in the terminal I run:

phonegap run android 

to create and install the application on your tablet.

+2
javascript android ios cordova
source share
2 answers

To bind orientation in iOS: just open the project in Xcode and click on the project and inside the summary, you can choose the orientation enter image description here

For Android, add android:screenOrientation="landscape" to each action, for example:

 <activity android:name=".SomeActivity" android:label="@string/app_name" android:screenOrientation="landscape"> 
+3
source share

I had to do the following (cordova 3.3): in * -info.plist - I had:

  <key>UISupportedInterfaceOrientations</key> <array/> <key>UISupportedInterfaceOrientations~ipad</key> <array> <string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationPortraitUpsideDown</string> <string>UIInterfaceOrientationLandscapeRight</string> </array> 

I change it to:

 <key>UISupportedInterfaceOrientations</key> <array/> <key>UISupportedInterfaceOrientations~ipad</key> <array> <string>UIInterfaceOrientationPortrait</string> </array> 
+1
source share

All Articles