0

I'm working on a libGDX application and based on this question I'm forcing portrait orientation in activity tag of AndroidManifest.xml like this:

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

This used to work fine on my devices until my Samsung Galaxy S4 got upgraded to Lollipop (5.0.1) from KitKat. Now it doesn't work on this device, while still working on others (with lower Android versions). On the S4 it just displays the application in landscape, ignoring rotation.

I was looking for differences in the 5.0 API that could explain this, but couldn't find anything.

Edit: I've just tried exporting my app to .apk and it displayed properly. Previously I was running it from Eclipse debug mode. It shouldn't be hard to pinpoint the issue, but I don't have time to investigate it at the moment.

Edit2: I've just tried running it from Eclipse on a different machine, where I have API 21 (so Lollipop) and it worked. However my working .apk has been exported on another machine, where I have API 20. It's really puzzling me. Might be something related to Android plugin versions, but I'm not sure if I will be able to pinpoint it.

Community
  • 1
  • 1
Chanandler Bong
  • 403
  • 1
  • 11
  • 23
  • Is auto rotation activated? Goto settings-> accessibility-> enable AUTO ROTATE – Alexios Karapetsas Jul 28 '15 at 14:23
  • @AlexiosKarapetsas Enabling/disabling it doesn't change anything (although auto rotate works, I've checked). I don't have this option under 'Accessibility', but under 'Display' -> 'Screen' section. – Chanandler Bong Jul 28 '15 at 18:32

1 Answers1

0

try

android:screenOrientation="sensorPortrait"

I am not sure what your API level. But there was a google bug around this issue, which was fixed by API 16. If you are using anything earlier and if above line does not work, try

android:screenOrientation="sensorPortait"

instead.

Alp
  • 3,027
  • 1
  • 13
  • 28