I am trying to create a cordova plugin that will "listen" to any onKeyUp
event and pass the keyCode
to the callback function.
The goal is to detect ANY keystroke coming from an external keyboard / barcode scanner - any character (for example, 0,1,2,3 ... a, b, c, ...)
My problem: how to add an onKeyUp
listener?
Here is what I still have:
package il.co.pnc.cordova.keystrokes; import org.apache.cordova.CallbackContext; import org.apache.cordova.CordovaInterface; import org.apache.cordova.CordovaPlugin; import org.apache.cordova.CordovaWebView; import org.apache.cordova.PluginResult; import android.view.View; import android.view.View.OnKeyListener; import android.view.KeyEvent; public class keystrokes extends CordovaPlugin { private CallbackContext callback = null; @Override public boolean execute(String action, JSONArray data, CallbackContext callbackContext) throws JSONException {
So, I have no where to place onKeyUp
. As far as I know, this should be part of the core business ...?
source share