I would like to check in a library/class if the application is defined as fixed (portrait or landscape) or unspecified, or if its rotation is prevented by the user. How can this be found by code ?
Thanks.
I didn't find any API that tests whether the orientation sensor is disabled. PackageManager from the Phone library doesn't provide this information either. Maybe you can get it with JavaObject. Try to find Java code that does it.
I just can't understand why you want to know if the user has "fixed" his device orientation...
AFAIK you either code orientation fixed apps or allow your app to adjust to an orientation change, so even if the device is in fixed portrait mode, if you have made your app landscape fixed, it will show that way, and vice-versa... so... Why the need to know is the device itself is in fixed mode?
I am trying to improve a class, not to solve an application problem. As a class it can be used in any application.
If you have read this http://www.b4x.com/android/forum/threads/freeze-orientation.41681/ you know that there is a problem with modal dialoges when the screen is rotated. The last solution mentioned there is to inhibit the rotation and after the dialog is returned - to rotate the screen, but the value you read before is not the same as the value you use to rotate.
Since there is still a problem with this solution I prefer not to use it when the application is not free to rotate.