This issue has come up many times. In addition to using the SetOrientationAllowed command, it is necessary to set some platform specific project values.
For iOS, it has been discussed before and is relatively simple. First set the desired orientations in
both the iPhone/iPod and iPad Deployment Info sections under the Summary tab when your TARGET app is selected. Then you make sure to have the correct lines in <yourapp>-Info.plist (
UIInterfaceOrientation sets the initial app orientation and
UISupportedInterfaceOrientations has the list of allowed orientations):
<key>UIInterfaceOrientation</key>
<string>UIInterfaceOrientationLandscapeLeft</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
</array>
The values to use for specific orientations are:
UIInterfaceOrientationPortrait - normal portrait, home button on bottom, AppGameKit orientation 1
UIInterfaceOrientationPortraitUpsideDown - reverse portrait, home button on top, AppGameKit orientation 2
UIInterfaceOrientationLandscapeLeft - normal landscape, home button on left, AppGameKit orientation
4 (four, not three)
UIInterfaceOrientationLandscapeRight - reverse landscape, home button on right, AppGameKit orientation
3 (three, not four)
There is no issue of initial black flash with iOS because of the use of the Default.png images (and there is one for every possible resolution, device and orientation).
I recently (thanks to Naphier) found out how to force an Android app to a specific initial orientation. This is done in the AndroidManifest.xml file (and make sure to make the change in the <appdir>/AndroidManifest.xml and <appdir/bin/AndroidManifest.xml):
<activity android:name="android.app.NativeActivity"
android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="reverseLandscape">
<meta-data android:name="android.app.lib_name"
android:value="android_player" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
The key line is: android:screenOrientation="reverseLandscape"
The values entered work like this (from
this page and mentioning only the ones that we are likely to use):
"landscape" - Landscape orientation (the display is wider than it is tall). This is AppGameKit orientation 3 (home button on right on well behaved devices)
"portrait"- Portrait orientation (the display is taller than it is wide). This is AppGameKit orientation 1 (home button on bottom OWBD)
"reverseLandscape" - Landscape orientation in the opposite direction from normal landscape. This is AppGameKit orientation 4 (home button on left OWBD)
"reversePortrait"- Portrait orientation in the opposite direction from normal portrait. This is AppGameKit orientation 2 (home button on top OWBD)
"sensorLandscape" - Landscape orientation, but can be either normal or reverse landscape based on the device sensor. AppGameKit orient 3 or 4. But always one or the other.
"sensorPortrait" - Portrait orientation, but can be either normal or reverse portrait based on the device sensor. AppGameKit orient 1 or 2.
"sensor" - The orientation is determined by the device orientation sensor. The orientation of the display depends on how the user is holding the device; it changes when the user rotates the device. Some devices, though, will not rotate to all four possible orientations, by default. To allow all four orientations, use "fullSensor".
"fullSensor" - The orientation is determined by the device orientation sensor for any of the 4 orientations. This is similar to "sensor" except this allows any of the 4 possible screen orientations, regardless of what the device will normally do (for example, some devices won't normally use reverse portrait or reverse landscape, but this enables those).
I use "reverseLandscape" and it works very nicely. But it still didn't solve the issue of the AGKSplash.png file (in the assets directory) insisting on displaying as if the device were in portrait mode. This is something that needs to be settable in the core AppGameKit libraries somehow for Android.
Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master