Kha
Kha copied to clipboard
Android screen rotation
Describe the solution you'd like
An Android implementation for kha.System.screenRotation
— and a notification about the screen change would be even more awesome.
Describe alternatives you've considered Constantly polling window dimensions — it is something that can work in simple cases... but not for everything.
In fact, in my specific case (resizing and repositioning screen elements, like a gamepad) it would suffice if Window.notifyOnResize
would be fired because of the screen dimensions changing... but it is not the case.
[...] it would suffice if Window.notifyOnResize would be fired because of the screen dimensions changing... but it is not the case.
That actually looks like a bug in Android 8, or something — I've found references about the underlying Android method (ANativeActivityCallbacks.onNativeWindowResized
) firing when screen rotation changes, so I've tested it with another phone:
- LG G5, Android 8:
ANativeActivityCallbacks.onNativeWindowResized
not getting called when screen orientation changes. - Redmi Note 8, Android 9:
ANativeActivityCallbacks.onNativeWindowResized
gets called when screen orientation changes.