-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Orientation not working on Android #75
Comments
Sorry, clicked the wrong button. Can you elaborate what's the difference in your fix and why it works again as expected? |
From the android docs Sensor:
Unspecified:
It sounds like if we used |
Hey guys, thanks for the quick reply. 🤘 In the end I decided to create a demo project showing the issue that we're facing. After some hours of debugging why our project actually has this behaviour, I found what was causing this weird behaviour here You can run my demo project and see that running screen.orientation.unlock() will cause the screen to lock to portrait for some reason. This is probably caused by the underlaying activity somehow being locked to portrait by this and the unspecified option used by this plugin will use this as seen in the docs
Aside from this my 'fix' was using Sensor as breautek mentioned, which is also not really ideal since it would ignore the user settings, so I changed it to use the 'ActivityInfo.SCREEN_ORIENTATION_USER' as seen here. This will only use the sensor if enabled. As a developer I would expect that calling screen.orientation.unlock() would actually unlock the screen orientation by using the sensor if enabled in the settings, thus I think it would be best to change it to ActivityInfo.SCREEN_ORIENTATION_USER. Anyway our issue is fixed, so I rest my case. Thanks for the support! |
In my case, .lock("landscape") doesn't work. It either still uses the setting from the config.xml or, if you used .unlock() first, the phone will still use all orientations instead of just "landscape". |
Bug Report
Problem
Since a few weeks we noticed that the orientation suddenly didn't allow unlocking anymore in our app.
What is expected to happen?
After calling unlock(), the app should use the sensor for the right orientation.
What does actually happen?
When calling unlock(), it was going back to forced portrait.
Environment, Platform, Device
Tried on multiple android devices.
Version information
I've made a fix which we are using now, which can be found here.
The text was updated successfully, but these errors were encountered: