Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-417

D-pad events not firing in Google TV

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 1.4.0, 1.5.0
    • None
    • cordova-android
    • Eclipse on Linux with Google TV add-on, Phonegap 1.5 & 1.4 (only tested these versions)

    Description

      Any Javascript calls to D-pad events or special button events (Play, FFW, etc...) don't fire in Phonegap.

      Have tried: keypress, keydown, keyup.

      However, if I register an override in the main js file like this:
      [code]
      @Override
      public boolean onKeyDown(int keyCode, KeyEvent event) {
      WebView myWebView = (WebView) findViewById(R.id.webview);
      if (keyCode == KeyEvent.KEYCODE_DPAD_UP)

      { myWebView.loadUrl("javascript:daleTecla('UP');"); return true; }

      if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN)

      { myWebView.loadUrl("javascript:daleTecla('DOWN');"); return true; }

      if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT)

      { myWebView.loadUrl("javascript:daleTecla('LEFT');"); return true; }

      if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT)

      { myWebView.loadUrl("javascript:daleTecla('RIGHT');"); return true; }

      if (keyCode == KeyEvent.KEYCODE_ENTER || keyCode == KeyEvent.KEYCODE_DPAD_CENTER)

      { myWebView.loadUrl("javascript:daleTecla('ENTER');"); return true; }

      if (keyCode == KeyEvent.KEYCODE_MEDIA_PLAY || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE)

      { myWebView.loadUrl("javascript:daleTecla('PLAYPAUSE');"); return true; }

      if (keyCode == KeyEvent.KEYCODE_MEDIA_NEXT)

      { myWebView.loadUrl("javascript:daleTecla('NEXT');"); return true; }

      if (keyCode == KeyEvent.KEYCODE_MEDIA_PREVIOUS)

      { myWebView.loadUrl("javascript:daleTecla('PREV');"); return true; }

      if (keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD)

      { myWebView.loadUrl("javascript:daleTecla('FFW');"); return true; }

      if (keyCode == KeyEvent.KEYCODE_MEDIA_REWIND)

      { myWebView.loadUrl("javascript:daleTecla('REW');"); return true; }

      if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP)

      { myWebView.loadUrl("javascript:daleTecla('STOP');"); return true; }

      if (keyCode == KeyEvent.KEYCODE_MENU)

      { myWebView.loadUrl("javascript:daleTecla('MENU');"); return true; }

      return super.onKeyDown(keyCode, event);
      }
      [/code]

      The javascript "daleTecla" (my keypress handler), receives all except KEYCODE_DPAD_LEFT. Sometimes, but only AFTER DPAD_RIGHT is called, DPAD_LEFT fires, this is not consistent behavior though.

      Attachments

        Activity

          People

            bowserj Joey Robert Bowser
            hdezela Hugo De Zela
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: