Timo Sehrbruch
Posts: 0
Joined: Thu May 09, 2013 7:41 pm

Lock Orientation on Android

thanks, i re-did the step, and now it works.

can be makred as resolved :)

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Lock Orientation on Android

Hi Timo! Thank you for update! Glad it's working!

ang .
Posts: 0
Joined: Thu Jan 09, 2014 3:13 am

Lock Orientation on Android

I added the same code but the screen is still rotatable?
No build errors.

code
<?xml version="1&#46;0" encoding="utf-8"?>
<manifest xmlns:android="http:&#47;&#47;schemas&#46;android&#46;com/apk/res/android"
android:versionCode="7"
android:versionName="1&#46;0&#46;5" package="com&#46;gamemall2u&#46;gmgc">
<!-- GCM requires Android SDK version 2&#46;2 (API level 8) or above&#46; -->
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8"/>

<supports-screens android:largeScreens="true"
android:normalScreens="true" android:smallScreens="true"
android:resizeable="true" android:anyDensity="true" />

Code: Select all

 <permission android:name="com&#46;gamemall2u&#46;gmgc&#46;permission&#46;C2D_MESSAGE" 
     android:protectionLevel="signature" /> 
 <!-- Creates a custom permission so only this app can receive its messages&#46; --> 
 <uses-permission android:name="com&#46;gamemall2u&#46;gmgc&#46;permission&#46;C2D_MESSAGE" /> 

<uses-permission android:name="com&#46;google&#46;android&#46;c2dm&#46;permission&#46;RECEIVE"/>

<uses-permission android:name="android&#46;permission&#46;ACCESS_NETWORK_STATE" />
<uses-permission android:name="android&#46;permission&#46;INTERNET" />
<uses-permission android:name="android&#46;permission&#46;READ_PHONE_STATE" />
<uses-permission android:name="android&#46;permission&#46;WAKE_LOCK" />

<application android:icon="@drawable/appicon" android:label="@string/app_name" android:debuggable="false">
<activity android:name="&#46;PhoneGapActivity" android:launchMode="singleTop" android:configChanges="orientation|keyboardHidden" android:screenOrientation="portrait">
/code

deveu
Posts: 0
Joined: Tue Apr 08, 2014 4:10 am

Lock Orientation on Android

I'm trying to get my android app to show in landscape only and have replaced the following code:
<activity android:name=".PhoneGapActivity" android:launchMode="singleTop" android:configChanges="orientation|keyboardHidden">

with:
<activity android:name=".PhoneGapActivity" android:launchMode="singleTop" android:configChanges="orientation|keyboardHidden" android:screenOrientation="landscape">

in my Source > ANDROID > business_android > AndroidManifest.xml

When testing using Android 4.3 Samsung Galaxy S3 i9305 I can't get the app to show 1280 width in landscape (I tested via apk and via appery tester)

http://appery.io/app/view/3d5107cf-12...

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Lock Orientation on Android

Hello,

Please provide us with more details what do you mean with "can't get the app to show width 1280"?
Can you please give us a screenshot? And when you test in the browser with different screen sizes (test frame or browser window, if you are testing without frame) everything works as you expect?

Alessandro Pietrosanti
Posts: 0
Joined: Tue Jul 29, 2014 7:48 am

Lock Orientation on Android

Hi, I need lock iPhone in portrait mode...what can i do? :)

Thanks for reply, Alessandro.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Lock Orientation on Android

Hello Alessandro,

You can do that on App Settings--iOS Keys tab. This post should help https://getsatisfaction.com/apperyio/...

Alessandro Pietrosanti
Posts: 0
Joined: Tue Jul 29, 2014 7:48 am

Lock Orientation on Android

Thank you! :) have a nice day

Mike6580064
Posts: 0
Joined: Wed Jan 15, 2014 6:00 pm

Lock Orientation on Android

I just want to clarify the correct fix for locking my app in portrait mode on Android.

On the AndroidManifest.xml file I see two instances that appear to deal with orientation and I'm not sure which one to edit:

activity android:name=".PhoneGapActivity" android:launchMode="singleTop" android:configChanges="orientation|keyboardHidden|screenSize"

and

activity android:name="com.google.zxing.client.android.CaptureActivity"
android:screenOrientation="landscape" android:configChanges="orientation|keyboardHidden"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:windowSoftInputMode="stateAlwaysHidden"

M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

Lock Orientation on Android

hi Mike,

It is the first one. It should look like this

code
<activity android:name="&#46;PhoneGapActivity" android:launchMode="singleTop" android:configChanges="orientation|keyboardHidden|screenSize" android:screenOrientation="portrait" >
/code

I had no issues getting the orientation to lock in portrait mode on Android. But I haven't been able to get the sensorPortrait to work though. Heard somewhere along the line google made a typo and replaced sensorPortrait by sensorPortait

Return to “Issues”