1

My app sets the screen orientation explicitly in the activity declaration in Manifest:

android:screenOrientation="portrait"
android:configChanges="orientation|screenSize|keyboardHidden"

However, the orientation is always landscape. Furthermore, there is no option for enabling orientation in settings>display or settings>accessibility.

Under what circumstances will Android determine the orientation?

Using API 19. I am running my app on this Android PC.

Roy Hinkley
  • 10,111
  • 21
  • 80
  • 120

2 Answers2

1

This, most likely, is not possible for your "Android Mini PC RK3288". Based on your observations that there is no settings control for auto-rotate enable/disable or orientation config and that this device uses an HDMI connection for a screen output, it is likely to be hardcoded to always output in landscape. Hoewever, you should reach out to manufacturer for and ask them to verify this. Maybe they have details or secrets to enable this? It cant hurt to ask.

In the meantime, it is possible to perform Rotating a view in Android. This workaround, ought to work for you.

HTHs

Community
  • 1
  • 1
petey
  • 16,914
  • 6
  • 65
  • 97
  • Rotating my be an intriguing workaround. I will keep you posted. Thanks! – Roy Hinkley Mar 08 '15 at 17:55
  • Well, it orients the way I desire, but since the screen is (1920x1032), there is space on the top and bottom - a lot of space. – Roy Hinkley Mar 08 '15 at 18:09
  • try `android:theme="@android:style/Theme.NoTitleBar.Fullscreen"` or make you ui show in a [dialog fragment that is full screen](http://stackoverflow.com/questions/7189948/full-screen-dialogfragment-in-android/26163346) – petey Mar 08 '15 at 18:12
  • Sorry, that did not have any affect. – Roy Hinkley Mar 08 '15 at 18:50
  • While it's not officially the answer to the question. Your suggestion has resolved my dilemma in the short-term. BTW, the space on the top and bottom were overcome with negative margin values. Thank you!!! – Roy Hinkley Mar 08 '15 at 19:08
  • nice. glad to help out. – petey Mar 08 '15 at 21:16
0

At the documentation there is a Note

Note: When you declare one of the landscape or portrait values, it is considered a hard requirement for the orientation in which the activity runs. As such, the value you declare enables filtering by services such as Google Play so your application is available only to devices that support the orientation required by your activities. For example, if you declare either "landscape", "reverseLandscape", or "sensorLandscape", then your application will be available only to devices that support landscape orientation. However, you should also explicitly declare that your application requires either portrait or landscape orientation with the element. For example, . This is purely a filtering behavior provided by Google Play (and other services that support it) and the platform itself does not control whether your app can be installed when a device supports only certain orientations.

So I guess that the device you are using has something different in this support or does not support it at all!

Something else that you should have in mind is that you can install/test such apps throw adb to devices that the Google Play will not allow to be installed due to these filtering features.


Another way to force orientation is by using

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

before setting the screen of each activity ie. before the setContentView(R.layout.activity_main); .

Even this code is not sure that is going to work on your device.

In the past, I have got reports of strange behaviors regarding orientation locking but it was quite the opposite as the setRequestedOrientation doesn't work whereas the lock thought AndroidManifest.xml is working.

madlymad
  • 6,367
  • 6
  • 37
  • 68