You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2020/10/19 08:59:30 UTC

[GitHub] [cordova-plugin-screen-orientation] florisdh opened a new issue #75: Orientation not working on Android

florisdh opened a new issue #75:
URL: https://github.com/apache/cordova-plugin-screen-orientation/issues/75


   # 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
   - @capacitor/*: 2.4.0
   - Android build: (minSdkVersion = 21, compileSdkVersion = 29, targetSdkVersion = 29)
   - Android version: 10
   
   I've made a fix which we are using now, which can be found [here](https://github.com/florisdh/cordova-plugin-screen-orientation/commit/4fc347e30e70125ff6a5b5a6302e23ea8c60e957).
   - Based on the [3.0.2](https://github.com/apache/cordova-plugin-screen-orientation/releases/tag/3.0.2) tag since the master branch didn't work for us


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-screen-orientation] Andalusio commented on issue #75: Orientation not working on Android

Posted by GitBox <gi...@apache.org>.
Andalusio commented on issue #75:
URL: https://github.com/apache/cordova-plugin-screen-orientation/issues/75#issuecomment-738040649


   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".


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-screen-orientation] florisdh commented on issue #75: Orientation not working on Android

Posted by GitBox <gi...@apache.org>.
florisdh commented on issue #75:
URL: https://github.com/apache/cordova-plugin-screen-orientation/issues/75#issuecomment-713072580


   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](https://github.com/florisdh/capacitor-orientation-bug/commit/b16a1602559138cf5051cb1321b08ffdfe90e047)
   
   You can run my [demo project](https://github.com/florisdh/capacitor-orientation-bug) 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](https://github.com/florisdh/capacitor-orientation-bug/commit/b16a1602559138cf5051cb1321b08ffdfe90e047) and the **unspecified** option used by this plugin will use this as seen in the docs
   > Unspecified: ... This will either be the orientation selected by the activity below, or  ...
   
   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](https://github.com/florisdh/cordova-plugin-screen-orientation/commit/8f99ca366a9adee948242b630586d4e2fe733d52). 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!


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-screen-orientation] timbru31 closed issue #75: Orientation not working on Android

Posted by GitBox <gi...@apache.org>.
timbru31 closed issue #75:
URL: https://github.com/apache/cordova-plugin-screen-orientation/issues/75


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-screen-orientation] breautek commented on issue #75: Orientation not working on Android

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #75:
URL: https://github.com/apache/cordova-plugin-screen-orientation/issues/75#issuecomment-712359680


   From the android [docs](https://developer.android.com/reference/android/R.attr#screenOrientation)
   
   Sensor:
   
   > Orientation is determined by a physical orientation sensor: the display will rotate based on how the user moves the device. Ignores user's setting to turn off sensor-based rotation.
   
   Unspecified:
   
   > No preference specified: let the system decide the best orientation. This will either be the orientation selected by the activity below, or the user's preferred orientation if this activity is the bottom of a task. If the user explicitly turned off sensor based orientation through settings sensor based device rotation will be ignored. If not by default sensor based orientation will be taken into account and the orientation will changed based on how the user rotates the device.
   
   It sounds like if we used `sensor` it may cause the app to ignore user settings, which sounds like a bad assumption to make. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-screen-orientation] timbru31 commented on issue #75: Orientation not working on Android

Posted by GitBox <gi...@apache.org>.
timbru31 commented on issue #75:
URL: https://github.com/apache/cordova-plugin-screen-orientation/issues/75#issuecomment-712356247


   Sorry, clicked the wrong button. Can you elaborate what's the difference in your fix and why it works again as expected?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org