-
Notifications
You must be signed in to change notification settings - Fork 500
[Bug] DisplayInfoChanged invoked with wrong orientation #1355
Comments
I can confirm this one too. Same steps to reproduce. |
Can also confirm this issue. Any update on when this will be fixed? |
I can't seem to reproduce this. Just tested the sample app on my Android 9 device. Could you submit a sample app or a snippet that I can copy paste and see what the difference is? |
Mattleibow: The issue is not with a physical device, just the Android emulator. It works correctly with my Samsung S10+ and fails in the Pixel3 Q 10.0 emulator. |
I think it is a known issue maybe on emulators something with timing. |
Ah.... Maybe in the event handler, you can add a delay before actually reading the values? Probably just needs like a 10ms delay or even less. |
@mattleibow So I've updated the sample project and tested it out.
Interestingly enough I also realised that the event is called twice when using a physical device. Once with the orientation that you had before turning your phone and the second one with the new orientation. This could be troublesome if someone has a big chunk of code depending on the orientation. As for the event not being raised on the first orientation switch: |
I believe this is just a bug with emulators in general and no real way to get around it :( You could put in a bigger delay and then check DeviceDisplay.MainDisplay and go from there. A work around that I can put in the code to do this is:
This is probably fine and gives the device time to process the change. |
I can confirm this bug exists on Android as described. Just wanted to report it myself. |
I have a problem on physical device HXY A9 Android 11.0 API 30. When I read DeviceDisplay.MainDisplayInfo.Orientation always returns DisplayOrientation.Portrait. |
Fixed #1355 delay processing change so OS updates
Description
When observing the MainDisplayInfoChanged of DeviceInfo you get Orientation Landscape when entering Protrait and vice versa.
In Addition to this, the OnDeviceOrientationChanged Event is only fired after you roatated the screen a second time.
On iOS it works as it should.
Steps to Reproduce
Expected Behavior
MainDisplayInfoChanged should be invoke on the first roatation not only after the second.
When the phone is roatated to Landscape the Orientation in the DisplayInfoChangedEventArgs should be Landscape as well.
Same goes for Portrait.
Actual Behavior
MainDisplayInfoChanged invokes only after the second roatation.
When the phone is roatated to Landscape the Orientation in the DisplayInfoChangedEventArgs is Portrait. The same issue applies to Portait rotation.
Basic Information
Reproduction Link
Link
The text was updated successfully, but these errors were encountered: