question

DrHenley avatar image
DrHenley asked

Fire Phone Screen Orientation

I have "android:screenOrientation = "landscape" in the manifest, but it is behaving as if it were "android:screenOrientation = "sensorLandscape" In other words, it will not consistently start the app in a specific landscape orientation, which is necessary for the app to function properly. I have not seen this behavior before on any other android device. How do I force it to a specific rotation on startup?
fire phone
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Kevin@Amazon avatar image
Kevin@Amazon answered
Hi DrHenley, For SDK 13 and above, if you want to prevent runtime restarts due to orientation changes you will need to use android:configChanges. This is detailed here: http://developer.android.com/guide/topics/resources/runtime-changes.html For example, in your manifest you would declare: android:configChanges="keyboardHidden|orientation|screenSize"
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

DrHenley avatar image
DrHenley answered
I already have that in the Manifest. I am NOT having problems with the screen changing while in the app. The problem is that the app starts with the wrong orientation if rotated certain ways at launch. This only happens on the Fire Phone, not on any other Android tablet or phone. All other tablets and phones start with the same (correct) orientation no matter what the rotation is at app launch. Most Fire HD and HDX tablets have a funky orientation that is upside down from normal though. (8.9 HD being the only exception). For example, on a Fire HD 7" you have to shoot video with the camera lens at the bottom. I can force them in my app to take photos correctly with the lens at the top however. It is behaving as if the "normal" landscape orientation changes depending on how the phone is held. I want the camera lens (and the camera button) at the top not the bottom. If you start the app with the camera app at the bottom I want the app to start upside down so they will rotate the phone as to hold it correctly to use the camera. But it only starts in the correct orientation if the phone is held in that rotation when the app is launched. If held in any other rotation when the app is launched, the app starts so that the camera lens and button are on bottom if the app is right side up.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

DrHenley avatar image
DrHenley answered
Another symptom of the problem is that "landscape" and "reverseLandscape" behave exactly the same and result in the same orientation. They should result in opposite orientations, but they don't.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Kevin@Amazon avatar image
Kevin@Amazon answered
Hi DrHenley, This behavior is expected for the Fire Phone, where “landscape” behaves like “sensorLandscape”. To mitigate this, we suggest you write your app in a way so that the physical rotation of the device doesn’t matter. For camera apps, you could use Camera#setDisplayOrientation API https://developer.android.com/reference/android/hardware/Camera.html#setDisplayOrientation%28int%29 For other apps, you should read and follow advice outlined here: http://android-developers.blogspot.ie/2010/09/one-screen-turn-deserves-another.html
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.