@Override public boolean execute(String action,JSONArray args,CallbackContext callbackContext){
  this.callbackContext=callbackContext;
  if (action.equals(ENCODE)) {
    JSONObject obj=args.optJSONObject(0);
    if (obj != null) {
      String type=obj.optString(TYPE);
      String data=obj.optString(DATA);
      if (type == null) {
        type=TEXT_TYPE;
      }
      if (data == null) {
        callbackContext.error("User did not specify data to encode");
        return true;
      }
      encode(type,data);
    }
 else {
      callbackContext.error("User did not specify data to encode");
      return true;
    }
  }
 else   if (action.equals(SCAN)) {
    scan(args);
  }
 else {
    return false;
  }
  return true;
}

@ Override public boolean execute ( String action , JSONArray args , CallbackContext callbackContext ) { this . callbackContext = callbackContext ; if ( action . equals ( ENCODE ) ) { JSONObject obj = args . optJSONObject ( 0 ) ; if ( obj != null ) { String type = obj . optString ( TYPE ) ; String data = obj . optString ( DATA ) ; if ( type == null ) { type = TEXT_TYPE ; } if ( data == null ) { callbackContext . error ( "User did not specify data to encode" ) ; return true ; } encode ( type , data ) ; } else { callbackContext . error ( "User did not specify data to encode" ) ; return true ; } } else if ( action . equals ( SCAN ) ) { scan ( args ) ; } else { return false ; } return true ; }
executes the request . this method is called from the webview thread . to do a non - trivial amount of work , use : cordova . getthreadpool ( ) . execute ( runnable ) ; to run on the ui thread , use : cordova . getactivity ( ) . runonuithread ( runnable ) ;
