Check if auto rotation is enabled

I have searched back and forth and could not find any solution to this issue:

At any given point during runtime of my Android or iOS app, I want to know if auto rotation is enabled. I am not thinking about system settings, I am interested in, if the unity player is currently have auto rotation enabled.

I haven’t found any way of doing that, but I hope it is possible in some way?

Thanks.

To info I ended up making native call to read the auto rotation setting. You will have to look up in more details how to do that. Search for native ios calls or how to create ios plugins for unity. Also, I only need this for iOS so I don’t have an Android solution.

In short pseudo code:

Create a method to call native code from Unity:

[DllImport("__Internal")]
internal static extern void __IOS_ReadAutoRotationSetting();

In native code you read the setting calling the method in UnityInterface.h:

int     UnityShouldAutorotate();

And then returning the setting as a string to unity using send message:

string hasAutorotation = UnityShouldAutorotate() as string
UnitySendMessage("IOSCallback", "__fromnative_AutoRotation", hasAutorotation)

From Unity read the string and convert it to a bool. Now you know if autorotation is on.
Ideally this should just be read directly from unity as part of unity, let me know if that is possible.