Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
x/mobile/app: config.Event delivery is not reliable (android) #11741
I slightly modified the basic app https://go-review.googlesource.com/#/c/12330/
Background color is red if Width > Height.
Keep rotating and touching the device. It's somewhat non-deterministic.
go version devel +adb1e03 Thu Jul 16 20:56:23 2015 +0000 darwin/amd64
The documentation is not clear on what we should be using.
Non-NativeActivity users talk about listening for onSurfaceChanged, which seems to translate into onNativeWindowResized, onNativeWindowCreated, and onNativeWindowDestroyed.
Right now we listen for onNativeWindowRedrawNeeded, which is onSurfaceRedrawNeeded.
Tomorrow I'll try to replicate the missing events, and see if switching to listening for onNativeWindowResized helps.
I put some logging into example/basic, and what I'm seeing (on a Galaxy Nexus) is reliable event delivery, but sometimes the width/height are not updated.
Also following the NativeActivity source through to the platform docs suggests onNativeWindowRedrawNeeded should be called for orientation changes, so it's a safe place to listen. Not sure yet what's wrong with querySurfaceWidthAndHeight.