Start a new topic

Lock landscape orientation

Lock landscape orientation


Thank you, this is exactly what I was looking for.

Since the activity containing the ArchitectView in your application is the same as the main activity, it's not possible to lock the orientation only by modifying the manifest xml file.

This behaviour is specific to PhoneGap, you can try to use some other PhoneGap plugin to lock the orientation when you open the ArchitectView. For example:

https://github.com/their/pg-plugin-screen-orientation

https://github.com/cogitor/PhoneGap-OrientationLock

Here is my complete manifest:

 

<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" android:windowSoftInputMode="adjustPan" package="com.example.testapp" xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <application android:debuggable="true" android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:name="TestApp" android:theme="@android:style/Theme.Black.NoTitleBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="com.wikitude.tools.activities.MediaPlayerActivity" android:screenOrientation="landscape">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
    </application>
    <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_GPS" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-feature android:glEsVersion="0x00020000" android:required="true" />
    <uses-feature android:name="android.hardware.camera" android:required="true" />
    <uses-feature android:name="android.hardware.location" android:required="true" />
    <uses-feature android:name="android.hardware.sensor.accelerometer" android:required="true" />
    <uses-feature android:name="android.hardware.sensor.compass" android:required="true" />
</manifest>

Yes, it's possible if the wikitude activity is not the same as the main activity. The MediaPlayerActivity is yet something different.

If you still have problems, please send your complete manifest xml.

The main application is defined to be able to change orientation based on the phone's rotation:

<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:name="TestApp" android:theme="@android:style/Theme.Black.NoTitleBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

Is it possible to allow the main activity to rotate but force the Wikitude activity to be landscape?

Hi,

From your code, it seems that you are only defining an orientation for the Media player, not for the main activity of your application.
How are the other activities defined in your xml file?

 

Hi,

I want phonegap to always launch my Wikitude activity in landscape mode. I have it set in my AndroidManifest.xml (see below), but no luck. Is there another way to do this?

 

In my AndroidManifest.xml: 

<activity android:name="com.wikitude.tools.activities.MediaPlayerActivity" android:screenOrientation="landscape">

            <intent-filter>

                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />

            </intent-filter>

</activity>
Login or Signup to post a comment