Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Locking orientation of Android devices to portrait or landscape only

$
0
0

I have experienced successful locking of Android orientation to portrait using the custom AndroidManifest.xml and putting the android:screenOrientation="portrait" in all activities. PROBLEM started when I recently upgraded to the ff specs: MAVERICKS, TI 3.2.3 GA, Android SDK 4.4.2 and later. Then on, nothing about orientation works afterwards. Has anyone experienced this before or maybe am just doing a code error. Please help. Here is my custom manifest code for reference:

<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
    <id>com.goldsgym.goldsgym</id>
    <name>Golds Gym Ph</name>
    <version>1.5</version>
    <publisher>rtan</publisher>
    <url>http://www.goldsph.com</url>
    <description>not specified</description>
    <copyright>2014 by rtan</copyright>
    <icon>appicon.png</icon>
    <persistent-wifi>false</persistent-wifi>
    <prerendered-icon>false</prerendered-icon>
    <statusbar-style>default</statusbar-style>
    <statusbar-hidden>false</statusbar-hidden>
    <fullscreen>false</fullscreen>
    <navbar-hidden>false</navbar-hidden>
    <analytics>true</analytics>
    <guid>5ff076a1-1d30-4b9b-982f-4c4b74d73699</guid>
    <property name="ti.ui.defaultunit" type="string">system</property>
    <iphone>
        <orientations device="iphone">
            <orientation>Ti.UI.PORTRAIT</orientation>
        </orientations>
        <orientations device="ipad">
            <orientation>Ti.UI.PORTRAIT</orientation>
            <orientation>Ti.UI.UPSIDE_PORTRAIT</orientation>
            <orientation>Ti.UI.LANDSCAPE_LEFT</orientation>
            <orientation>Ti.UI.LANDSCAPE_RIGHT</orientation>
        </orientations>
    </iphone>
    <android xmlns:android="http://schemas.android.com/apk/res/android">
        <manifest>
                <application android:icon="@drawable/appicon" android:label="Golds Gym Ph" android:name="GoldsGymPhApplication" android:debuggable="false">
                    <activity android:screenOrientation="portrait" android:name=".GoldsGymPhActivity" android:label="@string/app_name" android:theme="@style/Theme.Titanium" android:configChanges="keyboardHidden|orientation|screenSize">
                        <intent-filter>
                            <action android:name="android.intent.action.MAIN"/>
                            <category android:name="android.intent.category.LAUNCHER"/>
                        </intent-filter>
                    </activity>
                    <activity android:screenOrientation="portrait" android:name="org.appcelerator.titanium.TiActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>
                    <activity android:screenOrientation="portrait" android:name="org.appcelerator.titanium.TiTranslucentActivity" android:configChanges="keyboardHidden|orientation|screenSize" android:theme="@android:style/Theme.Translucent"/>
                    <activity android:screenOrientation="portrait" android:name="ti.modules.titanium.ui.android.TiPreferencesActivity" android:configChanges="screenSize"/>
                    <activity android:screenOrientation="portrait" android:name="ti.modules.titanium.map.TiMapActivity" android:configChanges="keyboardHidden|orientation|screenSize" android:launchMode="singleTask"/>
                    <uses-library android:name="com.google.android.maps"/>
                    <service android:name="org.appcelerator.titanium.analytics.TiAnalyticsService" android:exported="false"/>
                    <meta-data android:name="com.google.android.gms.version" android:value="4132500"/>
                </application>
            <supports-screens android:anyDensity="false"/>
        </manifest>
        <manifest android:versionCode="15" android:versionName="1.5.0"
            package="com.goldsgym.goldsgym" xmlns:android="http://schemas.android.com/apk/res/android"/>
        <!-- Allows the API to download data from Google Map servers -->
        <uses-permission android:name="android.permission.INTERNET"/>
        <!-- Allows the API to cache data -->
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
        <!-- Use GPS for device location -->
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
        <!-- Use Wi-Fi or mobile connection for device location -->
        <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
        <!-- Allows the API to access Google web-based services -->
        <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
        <!-- Specify OpenGL ES 2.0 as a requirement -->
        <uses-feature android:glEsVersion="0x00020000" android:required="true"/>
        <!-- Replace <com.domain.appid> with your application ID -->
        <uses-permission android:name="com.goldsgym.goldsgym.permission.MAPS_RECEIVE"/>
        <permission
            android:name="com.goldsgym.goldsgym.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
        <application>
            <!-- Replace "PASTE YOUR GOOGLE MAPS API KEY HERE" with the Google API key you obtained -->
            <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyB0nP0BL2XlqdZHJ9_21dfeyY2tO_gZX_c"/>
        </application>
    </android>
    <mobileweb>
        <precache/>
        <splash>
            <enabled>true</enabled>
            <inline-css-images>true</inline-css-images>
        </splash>
        <theme>default</theme>
    </mobileweb>
    <modules>
        <module platform="android">ti.map</module>
    </modules>
    <deployment-targets>
        <target device="android">true</target>
        <target device="blackberry">false</target>
        <target device="ipad">true</target>
        <target device="iphone">true</target>
        <target device="mobileweb">true</target>
        <target device="tizen">false</target>
    </deployment-targets>
    <sdk-version>3.2.3.GA</sdk-version>
</ti:app>

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>