'Detect if device auto orientation mode turned on or off in Flutter
I'm working on this app that uses a video player. In here I use 2 main options to change the orientation of the player, which are the fullscreen button, and the auto rotation feature (changes according to device orientation). For this I'm using 2 libraries, Auto orientation and
The functionality works perfectly fine, when the device auto rotation mode is turned on. But it misbehaves when it is turned off. I know how to fix this issue. But can't find a suitable library for this.
So basically what I need is, I want to run a specific set of code on the condition , if the device's auto orientation mode turnes on/off. So are there any flutter libraries available to check the auto rotation status? Basically I need to detect whether it is turned on or off. Any help would be highly appreciated :)
PS: I didn't add any code, because it's not the code I need help with. Thanks
Solution 1:[1]
There is a plugin for this, although it doesn't look like it's been updated in a while:
On Android it uses this:
Settings.System.getInt(activity?.contentResolver, Settings.System.ACCELEROMETER_ROTATION, 0) == 1
I don't think it supports iOS.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Joe Muller |