0

I have a service that overrides onConfigurationChanged.

It's getting called when you change orientation from portrait -> landscape and vice versa but the problem is when you are rotating from landscape -> landscape. When you are tilting your phone to the Left then you change it to the Right.

As said on many answers here on stackoverflow the manifest file should be:

android:configChanges="keyboardHidden|orientation|screenSize"

Changing orientation from side to side (Left and Right) results in the same screen size thus onConfigurationChanged never gets called.

My app relies on the accelerometer so I need to get the current orientation to adjust my values.

Any thoughts on how and why onConfigurationChanged doesn't get called?

Marlon
  • 1,839
  • 2
  • 19
  • 42

1 Answers1

0

Any thoughts on how and why onConfigurationChanged doesn't get called?

Because that's not considered to be a configuration change. Configuration changes are for where Google thinks that you will need different resources. Since the screen is the same size after the rotation as before, and since nothing else resource-wise is different, they do not consider this to be a configuration change.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491