List of usage examples for org.apache.cordova PluginResult PluginResult
public PluginResult(Status status)
From source file:com.megster.cordova.rfduino.Peripheral.java
License:Apache License
@Override public void onServicesDiscovered(BluetoothGatt gatt, int status) { Log.d(TAG, "gatt " + gatt); Log.d(TAG, "status " + status); super.onServicesDiscovered(gatt, status); BluetoothGattService service = gatt.getService(RFDUINO_SERVICE_UUID); Log.d(TAG, "service " + service); BluetoothGattCharacteristic receiveCharacteristic = service.getCharacteristic(RECEIVE_CHARACTERISTIC_UUID); sendCharacteristic = service.getCharacteristic(SEND_CHARACTERISTIC_UUID); disconnectCharacteristic = service.getCharacteristic(DISCONNECT_CHARACTERISTIC_UUID); if (receiveCharacteristic != null) { gatt.setCharacteristicNotification(receiveCharacteristic, true); BluetoothGattDescriptor receiveConfigDescriptor = receiveCharacteristic .getDescriptor(CLIENT_CHARACTERISTIC_CONFIGURATION_UUID); if (receiveConfigDescriptor != null) { receiveConfigDescriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE); gatt.writeDescriptor(receiveConfigDescriptor); } else {//from ww w .j a va 2 s . c o m LOG.e(TAG, "Receive Characteristic can not be configured."); } } else { LOG.e(TAG, "Receive Characteristic is missing."); } // call the success callback for connect PluginResult result = new PluginResult(PluginResult.Status.OK); result.setKeepCallback(true); connectCallback.sendPluginResult(result); }
From source file:com.megster.cordova.rfduino.RFduinoPlugin.java
License:Apache License
private void connect(CallbackContext callbackContext, String uuid) { Peripheral peripheral = peripherals.get(uuid); // note uuid is mac address on android BluetoothDevice device = peripheral.getDevice(); peripheral.setConnectCallback(callbackContext); gatt = device.connectGatt(cordova.getActivity(), false, peripheral); activePeripheral = peripheral;// w w w.j a v a2 s .co m PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT); result.setKeepCallback(true); callbackContext.sendPluginResult(result); }
From source file:com.megster.cordova.rfduino.RFduinoPlugin.java
License:Apache License
private void registerOnDataCallback(CallbackContext callbackContext) { // TODO this should accept a MAC address and allow a listener to be added to // any device, not just the active device. Requires JS and ObjC updates. if (activePeripheral != null) { activePeripheral.setOnDataCallback(callbackContext); PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT); result.setKeepCallback(true);//from w ww. ja v a 2s . c o m callbackContext.sendPluginResult(result); } else { callbackContext.error("No connected device"); } }
From source file:com.megster.cordova.rfduino.RFduinoPlugin.java
License:Apache License
private void findLowEnergyDevices(CallbackContext callbackContext, int scanSeconds) { // TODO skip if currently scanning peripherals.clear();/*from w w w . j a v a 2 s . c om*/ discoverCallback = callbackContext; bluetoothAdapter.startLeScan(new UUID[] { Peripheral.RFDUINO_SERVICE_UUID }, this); Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { LOG.d(TAG, "Stopping Scan"); RFduinoPlugin.this.bluetoothAdapter.stopLeScan(RFduinoPlugin.this); } }, scanSeconds * 1000); PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT); result.setKeepCallback(true); callbackContext.sendPluginResult(result); }
From source file:com.mirasense.scanditsdk.plugin.ScanditSDK.java
License:Apache License
@Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) { mCallbackContext = callbackContext;//w w w .j av a2 s . com PluginResult result = null; if (action.equals(SCAN)) { scan(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); return true; } else { result = new PluginResult(Status.INVALID_ACTION); callbackContext.error("Invalid Action"); return false; } }
From source file:com.msopentech.o365.outlookServices.OutlookServicesMethodsImpl.java
License:Open Source License
/** * Adds default callback that send future's result back to plugin * This is specially for raw SDK methods which returns a string typed future * * @param future Future to add callback to * @param context Plugin context used to send future result back to plugin *///from ww w. j a v a 2s . c o m static void addRawCordovaCallback(final ListenableFuture<String> future, final CallbackContext context) { Futures.addCallback(future, new FutureCallback<String>() { @Override public void onSuccess(String s) { PluginResult result = s == null ? new PluginResult(PluginResult.Status.OK) : new PluginResult(PluginResult.Status.OK, s); context.sendPluginResult(result); } @Override public void onFailure(Throwable throwable) { String error = throwable.getMessage(); if (throwable instanceof ODataException) { String response = new String(((ODataException) throwable).getODataResponse().getPayload()); // since error object is encapsulated into response's object // try to get it from response and return instead of raw throwable's message try { JSONObject errorMessage = new JSONObject(response); error = errorMessage.get("error").toString(); } catch (JSONException ignored) { } } context.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, error)); } }); }
From source file:com.nolgong.pedometer.Pedometer.java
License:Apache License
public void isStepCountingAvailable() { this.activityRunning = true; countSensor = sensorManager.getDefaultSensor(Sensor.TYPE_STEP_COUNTER); if (countSensor != null) { LOG.i(TAG, "isStepCountingAvailable() " + countSensor); sensorManager.registerListener(this, countSensor, SensorManager.SENSOR_DELAY_UI); PluginResult result = new PluginResult(PluginResult.Status.OK); result.setKeepCallback(true);/*from w ww . jav a2 s. c o m*/ callbackContext.sendPluginResult(result); } else { LOG.i(TAG, "isStepCountingAvailable() fail"); PluginResult err = new PluginResult(PluginResult.Status.ERROR); err.setKeepCallback(true); callbackContext.sendPluginResult(err); } }
From source file:com.phonegap.customcamera.NativeCameraLauncher.java
License:Apache License
@Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { PluginResult.Status status = PluginResult.Status.OK; String result = ""; this.callbackContext = callbackContext; try {/*from ww w . j a v a2s .com*/ if (action.equals("takePicture")) { this.targetHeight = 0; this.targetWidth = 0; this.mQuality = 80; this.targetHeight = args.getInt(4); this.targetWidth = args.getInt(3); this.mQuality = args.getInt(0); this.captureButtonColor = args.getString(12); this.captureButtonBorderColor = args.getString(14); this.brightnessThreshold = (float) args.getDouble(13); this.takePicture(); PluginResult r = new PluginResult(PluginResult.Status.NO_RESULT); r.setKeepCallback(true); callbackContext.sendPluginResult(r); return true; } return false; } catch (JSONException e) { e.printStackTrace(); callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION)); return true; } }
From source file:com.phonegap.plugin.BluetoothPlugin.java
License:Apache License
@Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) { Log.d(LOG_TAG, "Plugin Called"); this.callbackContext = callbackContext; PluginResult result = null;//from ww w . ja v a2 s . co m //Looper.prepare(); btadapter = BluetoothAdapter.getDefaultAdapter(); found_devices = new ArrayList<BluetoothDevice>(); if (ACTION_DISCOVER_DEVICES.equals(action)) { try { Log.d(LOG_TAG, "We're in " + ACTION_DISCOVER_DEVICES); found_devices.clear(); discovering = true; if (btadapter.isDiscovering()) { btadapter.cancelDiscovery(); } Log.i(LOG_TAG, "Discovering devices..."); btadapter.startDiscovery(); result = new PluginResult(PluginResult.Status.NO_RESULT); result.setKeepCallback(true); } catch (Exception Ex) { Log.d("BluetoothPlugin - " + ACTION_DISCOVER_DEVICES, "Got Exception " + Ex.getMessage()); result = new PluginResult(PluginResult.Status.ERROR); } } else if (ACTION_IS_BT_ENABLED.equals(action)) { try { Log.d(LOG_TAG, "We're in " + ACTION_IS_BT_ENABLED); boolean isEnabled = btadapter.isEnabled(); Log.d("BluetoothPlugin - " + ACTION_IS_BT_ENABLED, "Returning " + "is Bluetooth Enabled? " + isEnabled); result = new PluginResult(PluginResult.Status.OK, isEnabled); } catch (Exception Ex) { Log.d("BluetoothPlugin - " + ACTION_IS_BT_ENABLED, "Got Exception " + Ex.getMessage()); result = new PluginResult(PluginResult.Status.ERROR); } } else if (ACTION_ENABLE_BT.equals(action)) { try { Log.d(LOG_TAG, "We're in " + ACTION_ENABLE_BT); boolean enabled = false; Log.d(LOG_TAG, "Enabling Bluetooth..."); if (btadapter.isEnabled()) { enabled = true; } else { enabled = btadapter.enable(); } Log.d("BluetoothPlugin - " + ACTION_ENABLE_BT, "Returning " + "Result: " + enabled); result = new PluginResult(PluginResult.Status.OK, enabled); } catch (Exception Ex) { Log.d("BluetoothPlugin - " + ACTION_ENABLE_BT, "Got Exception " + Ex.getMessage()); result = new PluginResult(PluginResult.Status.ERROR); } } else if (ACTION_DISABLE_BT.equals(action)) { try { Log.d(LOG_TAG, "We're in " + ACTION_DISABLE_BT); boolean disabled = false; Log.d(LOG_TAG, "Disabling Bluetooth..."); if (btadapter.isEnabled()) { disabled = btadapter.disable(); } else { disabled = true; } Log.d("BluetoothPlugin - " + ACTION_DISABLE_BT, "Returning " + "Result: " + disabled); result = new PluginResult(PluginResult.Status.OK, disabled); } catch (Exception Ex) { Log.d("BluetoothPlugin - " + ACTION_DISABLE_BT, "Got Exception " + Ex.getMessage()); result = new PluginResult(PluginResult.Status.ERROR); } } else if (ACTION_PAIR_BT.equals(action)) { try { Log.d(LOG_TAG, "We're in " + ACTION_PAIR_BT); String addressDevice = args.getString(0); if (btadapter.isDiscovering()) { btadapter.cancelDiscovery(); } BluetoothDevice device = btadapter.getRemoteDevice(addressDevice); boolean paired = false; Log.d(LOG_TAG, "Pairing with Bluetooth device with name " + device.getName() + " and address " + device.getAddress()); try { Method m = device.getClass().getMethod("createBond"); paired = (Boolean) m.invoke(device); } catch (Exception e) { e.printStackTrace(); } Log.d("BluetoothPlugin - " + ACTION_PAIR_BT, "Returning " + "Result: " + paired); result = new PluginResult(PluginResult.Status.OK, paired); } catch (Exception Ex) { Log.d("BluetoothPlugin - " + ACTION_PAIR_BT, "Got Exception " + Ex.getMessage()); result = new PluginResult(PluginResult.Status.ERROR); } } else if (ACTION_UNPAIR_BT.equals(action)) { try { Log.d(LOG_TAG, "We're in " + ACTION_UNPAIR_BT); String addressDevice = args.getString(0); if (btadapter.isDiscovering()) { btadapter.cancelDiscovery(); } BluetoothDevice device = btadapter.getRemoteDevice(addressDevice); boolean unpaired = false; Log.d(LOG_TAG, "Unpairing Bluetooth device with " + device.getName() + " and address " + device.getAddress()); try { Method m = device.getClass().getMethod("removeBond"); unpaired = (Boolean) m.invoke(device); } catch (Exception e) { e.printStackTrace(); } Log.d("BluetoothPlugin - " + ACTION_UNPAIR_BT, "Returning " + "Result: " + unpaired); result = new PluginResult(PluginResult.Status.OK, unpaired); } catch (Exception Ex) { Log.d("BluetoothPlugin - " + ACTION_UNPAIR_BT, "Got Exception " + Ex.getMessage()); result = new PluginResult(PluginResult.Status.ERROR); } } else if (ACTION_LIST_BOUND_DEVICES.equals(action)) { try { Log.d(LOG_TAG, "We're in " + ACTION_LIST_BOUND_DEVICES); Log.d(LOG_TAG, "Getting paired devices..."); Set<BluetoothDevice> pairedDevices = btadapter.getBondedDevices(); int count = 0; String resultBoundDevices = "[ "; if (pairedDevices.size() > 0) { for (BluetoothDevice device : pairedDevices) { Log.i(LOG_TAG, device.getName() + " " + device.getAddress() + " " + device.getBondState()); if ((device.getName() != null) && (device.getBluetoothClass() != null)) { resultBoundDevices = resultBoundDevices + " { \"name\" : \"" + device.getName() + "\" ," + "\"address\" : \"" + device.getAddress() + "\" ," + "\"class\" : \"" + device.getBluetoothClass().getDeviceClass() + "\" }"; if (count < pairedDevices.size() - 1) resultBoundDevices = resultBoundDevices + ","; } else Log.i(LOG_TAG, device.getName() + " Problems retrieving attributes. Device not added "); count++; } } resultBoundDevices = resultBoundDevices + "] "; Log.d("BluetoothPlugin - " + ACTION_LIST_BOUND_DEVICES, "Returning " + resultBoundDevices); result = new PluginResult(PluginResult.Status.OK, resultBoundDevices); } catch (Exception Ex) { Log.d("BluetoothPlugin - " + ACTION_LIST_BOUND_DEVICES, "Got Exception " + Ex.getMessage()); result = new PluginResult(PluginResult.Status.ERROR); } } else if (ACTION_STOP_DISCOVERING_BT.equals(action)) { try { Log.d(LOG_TAG, "We're in " + ACTION_STOP_DISCOVERING_BT); boolean stopped = true; Log.d(LOG_TAG, "Stop Discovering Bluetooth Devices..."); if (btadapter.isDiscovering()) { Log.i(LOG_TAG, "Stop discovery..."); stopped = btadapter.cancelDiscovery(); discovering = false; } Log.d("BluetoothPlugin - " + ACTION_STOP_DISCOVERING_BT, "Returning " + "Result: " + stopped); result = new PluginResult(PluginResult.Status.OK, stopped); } catch (Exception Ex) { Log.d("BluetoothPlugin - " + ACTION_STOP_DISCOVERING_BT, "Got Exception " + Ex.getMessage()); result = new PluginResult(PluginResult.Status.ERROR); } } else if (ACTION_IS_BOUND_BT.equals(action)) { try { Log.d(LOG_TAG, "We're in " + ACTION_IS_BOUND_BT); String addressDevice = args.getString(0); BluetoothDevice device = btadapter.getRemoteDevice(addressDevice); Log.i(LOG_TAG, "BT Device in state " + device.getBondState()); boolean state = false; if (device != null && device.getBondState() == 12) state = true; else state = false; Log.d(LOG_TAG, "Is Bound with " + device.getName() + " - address " + device.getAddress()); Log.d("BluetoothPlugin - " + ACTION_IS_BOUND_BT, "Returning " + "Result: " + state); result = new PluginResult(PluginResult.Status.OK, state); } catch (Exception Ex) { Log.d("BluetoothPlugin - " + ACTION_IS_BOUND_BT, "Got Exception " + Ex.getMessage()); result = new PluginResult(PluginResult.Status.ERROR); } /* } else if ( ACTION_READ.equals(action) ) { final int socketId = args.getInt(0); final int bufferSize = args.getInt(1); this.callback_read = callbackContext; ReadThread readThread = new ReadThread( m_sockets.get(socketId),socketId,bufferSize); readThread.start(); m_readThreads.add(readThread); PluginResult pluginResult = new PluginResult( PluginResult.Status.NO_RESULT); pluginResult.setKeepCallback(true); callbackContext.sendPluginResult(pluginResult); return true; */ } else { result = new PluginResult(PluginResult.Status.INVALID_ACTION); Log.d(LOG_TAG, "Invalid action : " + action + " passed"); } this.callbackContext.sendPluginResult(result); return true; }
From source file:com.phonegap.plugins.Firebase.CDVFirebase.java
License:Apache License
/** * Executes the request.//from w ww. j ava 2 s. c o m * * This method is called from the Web. To do a non-trivial amount of work, use: * cordova.getThreadPool().execute(runnable); * * * @param action The action to execute. * @param args The exec() arguments. * @param callbackContext The callback context used when calling back into JavaScript. * @return Whether the action was valid. * * @sa https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaPlugin.java */ @Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) { PluginResult result = null; if (action.equals(INIT)) { mCallbackContext = callbackContext; init(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(SETPERSISTENCEENABLED)) { mCallbackContext = callbackContext; setPersistenceEnabled(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(READDATA)) { mCallbackContext = callbackContext; readData(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(READVALUETYPEEVENTWITHURL)) { mCallbackContext = callbackContext; readValueTypeEventWithURL(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(RETRIEVECHILDADDEDEVENTWITHURL)) { mCallbackContext = callbackContext; RetrieveChildAddedEventWithURL(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(RETRIEVECHILDCHANGEDEVENTWITHURL)) { mCallbackContext = callbackContext; RetrieveChildChangedEventWithURL(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(RETRIEVECHILDREMOVEDEVENTWITHURL)) { mCallbackContext = callbackContext; RetrieveChildRemovedEventWithURL(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(READDATAONCEWITHURL)) { mCallbackContext = callbackContext; readDataOnceWithURL(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(REMOVEALLCALLBACKSWITHURL)) { mCallbackContext = callbackContext; removeAllCallbacksWithURL(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(WRITEDATA)) { mCallbackContext = callbackContext; writeData(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(WRITEVALUETOURL)) { mCallbackContext = callbackContext; writeValueToURL(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(WRITEVALUETOURLWITHAUTOID)) { mCallbackContext = callbackContext; writeValueToURLWithAutoID(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(CHILDSET)) { mCallbackContext = callbackContext; childSet(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(AUTHWITHCUSTOMTOKEN)) { mCallbackContext = callbackContext; authWithCustomToken(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(ONDISCONNECTSETVALUE)) { mCallbackContext = callbackContext; onDisconnectSetValue(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(ONDISCONNECTSETVALUEWITHCOMPLETIONBLOCK)) { mCallbackContext = callbackContext; onDisconnectSetValueWithCompletionBlock(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(ONDISCONNECTREMOVEVALUE)) { mCallbackContext = callbackContext; onDisconnectRemoveValue(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(ONDISCONNECTREMOVEVALUEWITHCOMPLETIONBLOCK)) { mCallbackContext = callbackContext; onDisconnectRemoveValueWithCompletionBlock(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(ONDISCONNECTUPDATECHILDVALUES)) { mCallbackContext = callbackContext; onDisconnectUpdateChildValues(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(ONDISCONNECTUPDATECHILDVALUESWITHCOMPLETIONBLOCK)) { mCallbackContext = callbackContext; onDisconnectUpdateChildValuesWithCompletionBlock(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(CANCELDISCONNECTOPERATIONS)) { mCallbackContext = callbackContext; cancelDisconnectOperations(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(CANCELDISCONNECTOPERATIONSWITHCOMPLETIONBLOCK)) { mCallbackContext = callbackContext; cancelDisconnectOperationsWithCompletionBlock(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(QUERYLIMITEDTONUMBEROFCHILDREN)) { mCallbackContext = callbackContext; queryLimitedToNumberOfChildren(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(QUERYLIMITEDTOFIRST)) { mCallbackContext = callbackContext; queryLimitedToFirst(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(QUERYLIMITEDTOLAST)) { mCallbackContext = callbackContext; queryLimitedToLast(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(QUERYORDEREDBYCHILD)) { mCallbackContext = callbackContext; queryOrderedByChild(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(QUERYORDEREDBYKEY)) { mCallbackContext = callbackContext; queryOrderedByKey(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(QUERYSTARTINGATVALUE)) { mCallbackContext = callbackContext; queryStartingAtValue(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(QUERYSTARTINGATVALUECHILDKEY)) { mCallbackContext = callbackContext; queryStartingAtValueChildKey(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(QUERYENDINGATVALUE)) { mCallbackContext = callbackContext; queryEndingAtValue(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(QUERYENDINGATVALUECHILDKEY)) { mCallbackContext = callbackContext; queryEndingAtValueChildKey(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(QUERYEQUALTOVALUE)) { mCallbackContext = callbackContext; queryEqualToValue(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(QUERYEQUALTOVALUECHILDKEY)) { mCallbackContext = callbackContext; queryEqualToValueChildKey(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(QUERYSEARCH)) { mCallbackContext = callbackContext; try { querySearch(args); } catch (JSONException e) { e.printStackTrace(); } result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else if (action.equals(USERLOGIN)) { mCallbackContext = callbackContext; userLogin(args); result = new PluginResult(Status.NO_RESULT); result.setKeepCallback(true); mCallbackContext.sendPluginResult(result); return true; } else { result = new PluginResult(Status.INVALID_ACTION, "No Plugin Function: " + action); mCallbackContext.sendPluginResult(result); return false; } }