[ 
https://issues.apache.org/jira/browse/CB-9005?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16278769#comment-16278769
 ] 

Mike Dimmick (M-Netics) commented on CB-9005:
---------------------------------------------

I've taken this over - Ian Darling left the company some time ago. I recently 
discovered that when we upgraded to cordova-android 5.1.1, we managed to update 
the Java files without updating cordova.js, meaning we had a mix of 5.1.1 
native and 4.0.0 JavaScript. Amazingly this worked fine for over a year, and I 
wouldn't have spotted it had we not been bitten by the instability of the 
ONLINE_BRIDGE.

I'm now trying to upgrade to cordova-android 6.4.0 to pick up the newer native 
bridge, and have to re-apply the changes that we previously made. Is there now 
any better solution?

I should give some background on what we're actually doing. We work mainly with 
Zebra enterprise devices, such as their MC40, TC55, TC51 and TC56. These have a 
couple of extra buttons on either side of the unit, which - using the standard 
DataWedge app - trigger the barcode scanner. We use Zebra's Enterprise Mobility 
Developer Kit to gain greater control over the barcode scanner, configuring the 
types of barcode that are accepted for each input, which in turn is 
customisable by our clients. When using the EMDK, side scan button actions are 
delivered to the app rather than triggering the scanner, so we need to trigger 
the scanner when the button is pressed and deactivate when it's released. The 
side buttons generate KEYCODE_BUTTON_L1 and KEYCODE_BUTTON_R1 respectively.

> 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: cordova-android
>    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.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to