LoveForDroid LoveForDroid - 1 month ago 7
Android Question

App auto rotates even with device orientation locked

I am working on normal activity based application.
I have turned off device orientation from device settings.
When I run my app on device, the app changes orientation based on device movement.
I have no clue how can an app rotate even when device orientation is locked.
There is no such instance/issue reported or ever asked on stack overflow or any other forum.
Please point out, what I might be missing?

Answer Source

It was very silly mistake, but I thought of sharing here in case any one else faces this issue. At a point, in my application, I was setting device orientation programmatically to SCREEN_ORIENTATION_FULL_SENSOR:

activityContext.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);

This allows app to change orientation, based on sensor, even when user has locked the device orientation.