Skip to content Skip to sidebar Skip to footer

Webview On Amazon Fire Stick Not Responding To Controller

I've got an Android app in Cocos2d-x that uses a WebView to display the front end menu. Currently it's just a mock-up, and just has a URL to a website, which makes it easy to test

Solution 1:

In the end the problem was that I needed to call the superclass functions, not return false to indicate I hadn't processed the input. The cocos2d-x GameControllerActivity class isn't set up to cope with this, so I had to modify GameControllerActivity.java and add a new static member/functions to indicate when I wanted my app to have the controller input or if it was OK to pass it on to the WebView to process.

Extra functions:

private static boolean smGrabJoypadInput = false;

public static void grabJoypad() {
    smGrabJoypadInput = true;
}

public static void releaseJoypad() {
    smGrabJoypadInput = false;
}

Modified functions:

@Override
public boolean dispatchKeyEvent(KeyEvent event) {

if (!smGrabJoypadInput)
   return super.dispatchKeyEvent(event);
...

@Override
public boolean dispatchGenericMotionEvent(MotionEvent event) {

    if (!smGrabJoypadInput)
        return super.dispatchGenericMotionEvent(event);

Then I called these functions via JNI when I needed them.


Post a Comment for "Webview On Amazon Fire Stick Not Responding To Controller"