[
https://issues.apache.org/jira/browse/CB-9005?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14539588#comment-14539588
]
Ian Darling commented on CB-9005:
---------------------------------
Hi Joe,
Thank you for taking the time to respond.
In the general sense, I agree that this is not a major feature in the scheme of
things, although I did find a couple of plugins supporting gamepad APIs and
similar, which are trying to solve an almost identical problem, and will run
into this as they had similar key listener code to what I have.
I also don't think it's as simple as being able to add new key press events
similar to volumeup/down, as these use cases will require firing distinct
keydown and keyup events.
> Can no longer use setOnKeyListener on webView in plugins
> --------------------------------------------------------
>
> Key: CB-9005
> URL: https://issues.apache.org/jira/browse/CB-9005
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android, Plugins
> Affects Versions: 4.0.0
> Reporter: Ian Darling
> Assignee: Joe Bowser
> Priority: Minor
>
> I have a plugin that is used for handling "physical" key down/up events on
> Android devices with additional buttons - these buttons typically fire off
> KEYCODE_BUTTON_R1, etc
> In earlier versions of Cordova (3.7.0?) I was able to attach a keyListener in
> the plugin by doing:
> this.webView.setOnKeyListener(etc);
> In migrating to 4.0.0 this no longer compiles.
> My initial thought was to change to using
> this.webView.getView().setOnKeyListener instead (which appears to be the
> right way to do it), but this doesn't seem to fully work - my plugin still
> gets volume up/down key events (which I disregard), but not events for
> BUTTON_R1.
> Debugging CordovaLib suggests that CordovaWebViewImpl.onDispatchKeyEvent does
> receive the BUTTON_R1 events, but I'm at a loss as to how to get them into
> the plugin itself.
> Is there a workaround or alternate API I should be using?
> Thanks,
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]