Detect if device auto orientation mode turned on or off in Flutter - 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
Native device orientation
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

There is a plugin for this, although it doesn't look like it's been updated in a while:
auto_rotate_get
On Android it uses this:
Settings.System.getInt(activity?.contentResolver, Settings.System.ACCELEROMETER_ROTATION, 0) == 1
I don't think it supports iOS.

Related

Google VR SDK stuck in portrait mode

I've built the app and compiled it with VR enabled and cardboard selected as my VR device. I can install and run it on my phone (Samsung S8) BUT the in game camera is stuck in portrait mode and the yew is inverted (turning my head left turns the camera right). I have scoured the internet but still can't find a way to fix this.
I've enabled VR in playersettings and added google cardboard as my VR.
I've also disabled portrait views under orientation.
I've set the camera as both a child and parent object.
I've built the app with both cardboard and daydream selected as the VR (and each individually) but still the same issue.
I've tried forcing different higher levels of API requirement
I have added and removed GvrEditorEmulator from the project and the GvrControllerMain and no luck.
I've even flipped the camera manually by a 180 degrees and this made the view be in landscape but in this case the pitch was inverted (when I look up the camera looks down) and I haven't found a way to resolve this.
In the editor view the screen looks fine, but every time I run it on my Android phone it force starts in portrait mode and the pitch or yew is inverted.
Is there a hidden option I need to switch, does anybody have more suggestions that I could try?
You can see what the app looks like when I hold the phone i portrait mode on the link bellow (the image breaks when I try to add it to the post for some reason).
https://imgur.com/a/o80NRe4
Its worth mentioning that I'm working with Unity version 2019 2.0b2 because any other version I tried would not detect my installed Android SDK and would not let me build the project. I've tried on multiple machines and always had that problem so I'm afraid of attempting an upgrade to a newer version would break my build ability.
This seems to be a known and reported issue for Google VR SDK for unity. Its been reported on their github page.
The only possible fix is reverting back to Unity 2018.3.14f1. I did this by exporting my v2019 project, then creating a new 2018.3.14f1 version project and importing the original into it. This rebuilds the project and should avoid conflicts if you're lucky.

gwtbootstrap3-extras slider does not work properly on IPhone6s (OS.10.2.1)

I tried to use the Slider in my project.
When I tried to drag it using Chrome developer environment with device emulation turned on the tool-tips showing the current value are visible, but I cannot drag it.
When I tried the very same project on my IPhone, I can drag it perfectly but the tool-tips don't show up, so I can't see the value.
Any help will be very much appreciated.
I found out that using the attribute does the trick and it actually works on touch devices like my IPhone 6s . This is remarable because tooltips don't work on buttons using gwtbootstrap3. Actually they work but they take the first tip to show up. So you need to tip twice on a button which is not good.

iPhone front camera - tap to focus?

I'm trying to figure out if tap-to-focus is possible via the front facing camera device. I've seen on the iPhone4 wikipedia that it supports focus, but not much more detail. When I call isFocusPointOfInterestSupported on the front facing camera it returns NO, so...I would assume that it isn't supported. However, the apple camera app seems to have some tap support on the front facing camera - is this focus or is it adjusting exposure at the tap point?
To what capacity is focus supported on the front facing camera?
Thanks in advance for any response.
You can check on the Device Capture Settings of this page (documentation) that it doesn't support focus
https://developer.apple.com/library/ios/#documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/04_MediaCapture.html#//apple_ref/doc/uid/TP40010188-CH5-SW2
and you can see it with your actual phone, even if you move it back and forth it wont change the focus unlike the back camera.

iPhone app 'fake' landscape mode

So after wasting many hours trying to get my app to run in landscape mode by defualt I'm looking for an alternative.
My idea is to create the app in portrait mode but rotate everything by 90 degrees, the player thinks that he is playing the game in landscape mode (when really I've just rotated everything). I recognise it will be a little awkward to develop but I come into all sorts of issues when I try to program for landscape.
My question is, does Apple frown upon this? Could they reject my app for any reason or is this safe to do? Are there any issues I should be aware of?
Advice/articles/help all appreciated.
I do not allow landscape mode in my applications and none of them have been rejected. Sometimes an application does not benefit from being in landscape mode.
EDIT: The same also goes for portrait mode. If your app makes sense only in one orientation or the other, Apple will not reject you.
There is a key you can put into your Info.plist to make it start in landscape (see here). Or have you already tried that?
There are reportedly immersive full screen Open GL games that hide the status bar and do this. Note that you will still need to detect and handle landscape-left and landscape-right rotations or your app might appear upside-down.
Just set an affine transform on your top-level view, and be careful to always use the correct coordinate system.

iPhone game display is off the screen by 10 pixels or so on the device

I recently deployed my first iPhone app, a simple game, to my testing iPhone for the first time. Everything looks and runs fine on the simulator in Xcode, but on the iPhone the whole image is shifted up about 10 pixels or so. So the gameplay goes slightly offscreen on top and has a slim white/grey bar at the bottom. Has anyone encountered this before? I do have the status bar display turned off, I'm wondering if the device handles that flag differently than the simulator. I also have the rotation hardcoded to be in portraitRight mode at all times, and I have an extra line in the code to make the simulator do that automatically that's apparently not necessary on the device.
Everything is very simple, so I'm not sure where this glitch is coming from or even where to look.
Did you use Interface Builder to create your UI? If you did, then go and check each and every XIB file(s) objects' Size & Position as well as Autosizing in Size Inspector (command-3).
It's very important to check both: your coordinates might have gone wrong after some change you did and autoscaling works in weird ways unless you attach to correct edges. Apple documentation should help http://developer.apple.com/iphone/library/documentation/DeveloperTools/Conceptual/IB_UserGuide/Layout/Layout.html