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

Lock Orientation on Android

hey there, as I worked myself through the topics here, I found out that I have to export my app as eclipse project to edit the android manifest xml to enable orientation locking.

but I actually dont see why, because as refered in here (http://developer.android.com/guide/to...) the permissions which can be set within appery app builder are also in the manifest, so where is the deal with the orientation?

it would be a GREAT addition to have it in for android as well!

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Lock Orientation on Android

Hi Timo,

Sorry for the delay.

You would need to export your app to Eclipse project, then open AndroidManifest.xml file (not the one in "BarcodeScanner" folder).

Then replace the following code:
code<activity android:name="&#46;PhoneGapActivity" android:configChanges="orientation|keyboardHidden">/code
with the code below:
code<activity android:name="&#46;PhoneGapActivity" android:configChanges="orientation|keyboardHidden" android:screenOrientation="portrait">/code
You can find all possible values for android:screenOrientation in docs: http://developer.android.com/intl/ru/...)
But you would need to rebuild your app with Android SDK installed.

This is not the best solution as it's said here:
http://stackoverflow.com/questions/15...

Maybe you can develop a better solution.

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

Lock Orientation on Android

Thanks Katya for your answer.

I know the way with the Android Manifest and I think I will to it this way,

BUT (yeah, there is always a but..)

how can I savely compile my exported eclipse project to a apk?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Lock Orientation on Android

Hi Timo,

You can find an answer here:
https://developer.android.com/tools/i...

They have a lot of good guides.

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

Lock Orientation on Android

just another question/idea.

as the permissions for the app are also located in the AndroidManifest.xml, how come that the orientation string cannot be included, for example a simple dropdown within the wizard

Portrait
Landscape
Auto-Rotate (default)

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

obviously you can modify the xml below

code<application&#46;&#46;&#46;>/code

because of

code<activity android:name="&#46;PhoneGapActivity" android:configChanges="orientation|keyboardHidden">
<intent-filter>
<action android:name="com&#46;project&#46;name&#46;MESSAGE"&#47;>
/code

as I don't know how you create the AndroidManifest.xml, this is just a guess.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Lock Orientation on Android

Hi Timo,

We'll think about adding this feature.

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

Lock Orientation on Android

Hi Katya,

any recent updates regarding this issue?

Greetings

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

Lock Orientation on Android

Hello Timo! There is no plan to add dropdown to select those options, but there is no need to export app source code, you can edit AndroidManifest.xml on Source tab inside editor.

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

Lock Orientation on Android

Dear Maryna,

thanks for this hint, will try it immediatly and will give you feedback!

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

Lock Orientation on Android

I tried the following:

Then replace the following code:
code
<activity android:name="&#46;PhoneGapActivity" android:configChanges="orientation|keyboardHidden">
/code
with the code below:
code
<activity android:name="&#46;PhoneGapActivity" android:configChanges="orientation|keyboardHidden" android:screenOrientation="portrait">
/code

and then my build fails.

Return to “Issues”