I have an android tv web app created with cordova 6.4.0, cordova android 6.0.0, crosswalk 2.3.0 running on android 7.0. When I press left or right trigger buttons (aka l2 r2) on a gamepad controller (nvidia shield) the app is zoomed in/out. How can I prevent that from happening?
I've tried overriding
dispatchGenericMotionEvent(MotionEvent event)
{
return true;
}
to supress all motion events as I only need dpad,back and XYBA buttons. Unfortunately it disables dpad buttons too. It appears to me there's no way to distinguish between dpad and trigger buttons when MotionEvent objects are compared. The only difference I've found is that dpad events never come in a batch, but that's not enough to make a proper distinction.
There must be another way to tell whether dpad or trigger buttons are pressed. Somehow cordova/android makes the app zoom in when trigger buttons are pressed. So the check could be performed elsewhere?
It doesn't answer my question directly, but I fixed the issue by adding a meta tag to the index.html:
<meta name='viewport' content='initial-scale=1.0, maximum-scale=1.0, user-scalable=no'>