List of usage examples for org.json JSONArray getString
public String getString(int index) throws JSONException
From source file:au.com.borner.salesforce.client.rest.domain.AbstractJSONObject.java
public List<String> toStringList(JSONArray array) { try {//from ww w .j a v a 2 s . c om List<String> result = new ArrayList<String>(array.length()); for (int i = 0; i < array.length(); i++) { result.add(array.getString(i)); } return result; } catch (JSONException e) { return Collections.emptyList(); } }
From source file:nl.spellenclubeindhoven.dominionshuffle.Application.java
public void loadResult() { try {/*from w w w . j a va 2s. c om*/ JSONObject jsonResult = new JSONObject(DataReader.readStringFromFile(this, "result.json")); JSONArray jsonCards = jsonResult.getJSONArray("cards"); LinkedList<Card> cards = new LinkedList<Card>(); for (int i = 0; i < jsonCards.length(); i++) { Card card = dataReader.getData().getCard(jsonCards.getString(i)); if (card == null) return; cards.add(card); } Card baneCard = null; Card obeliskCard = null; if (jsonResult.has("baneCard")) { baneCard = dataReader.getData().getCard(jsonResult.getString("baneCard")); } if (jsonResult.has("obeliskCard")) { obeliskCard = dataReader.getData().getCard(jsonResult.getString("obeliskCard")); } result = new Result(); result.setCards(cards); result.setBaneCard(baneCard); result.setObeliskCard(obeliskCard); } catch (JSONException ignore) { ignore.printStackTrace(); } }
From source file:net.mandaria.radioreddit.apis.RadioRedditAPI.java
public static RadioStreams GetStreams(Context context, RadioRedditApplication application) { RadioStreams radiostreams = new RadioStreams(); radiostreams.ErrorMessage = ""; radiostreams.RadioStreams = new ArrayList<RadioStream>(); try {/*from w w w. j a va 2 s .co m*/ String url = context.getString(R.string.radio_reddit_streams); String outputStreams = ""; boolean errorGettingStreams = false; try { outputStreams = HTTPUtil.get(context, url); } catch (Exception ex) { errorGettingStreams = true; radiostreams.ErrorMessage = context.getString(R.string.error_RadioRedditServerIsDownNotification); application.radioRedditIsDownErrorMessage = radiostreams.ErrorMessage; application.isRadioRedditDown = true; } if (!errorGettingStreams && outputStreams.length() > 0) { JSONTokener tokener = new JSONTokener(outputStreams); JSONObject json = new JSONObject(tokener); JSONObject streams = json.getJSONObject("streams"); JSONArray streams_names = streams.names(); ArrayList<RadioStream> list_radiostreams = new ArrayList<RadioStream>(); // loop through each stream for (int i = 0; i < streams.length(); i++) { String name = streams_names.getString(i); JSONObject stream = streams.getJSONObject(name); RadioStream radiostream = new RadioStream(); radiostream.Name = name; // if(stream.has("type")) radiostream.Type = stream.getString("type"); radiostream.Description = stream.getString("description"); radiostream.Status = stream.getString("status"); // call status.json to get Relay // form url radioreddit.com + status + json String status_url = context.getString(R.string.radio_reddit_base_url) + radiostream.Status + context.getString(R.string.radio_reddit_status); String outputStatus = ""; boolean errorGettingStatus = false; try { outputStatus = HTTPUtil.get(context, status_url); } catch (Exception ex) { errorGettingStatus = true; radiostreams.ErrorMessage = context .getString(R.string.error_RadioRedditServerIsDownNotification); } //Log.e("RadioReddit", "Length of output: "+ outputStatus.length() + "; Content of output: " + outputStatus); // TODO: does outputStatus.length() > 0 need to be checked here and return a ErrorMessage back and set ErrorGettingStatus = true? if (!errorGettingStatus && outputStatus.length() > 0) { JSONTokener status_tokener = new JSONTokener(outputStatus); JSONObject status_json = new JSONObject(status_tokener); radiostream.Online = Boolean.parseBoolean(status_json.getString("online").toLowerCase()); if (radiostream.Online == true) // if offline, no other nodes are available { radiostream.Relay = status_json.getString("relay"); list_radiostreams.add(radiostream); } } } // JSON parsing reverses the list for some reason, fixing it... if (list_radiostreams.size() > 0) { // Sorting will happen later on select station activity //Collections.reverse(list_radiostreams); radiostreams.RadioStreams = list_radiostreams; application.isRadioRedditDown = false; } else { radiostreams.ErrorMessage = context.getString(R.string.error_NoStreams); application.radioRedditIsDownErrorMessage = radiostreams.ErrorMessage; application.isRadioRedditDown = true; } } } catch (Exception ex) { // We fail to get the streams... CustomExceptionHandler ceh = new CustomExceptionHandler(context); ceh.sendEmail(ex); radiostreams.ErrorMessage = ex.toString(); ex.printStackTrace(); } return radiostreams; }
From source file:ch.lom.clemens.android.bibliography.data.JSONWebConnector.java
public String[] getCollectionDocIDs(MCollection col, int page) { if (!isConnected()) { StartActivity.singleton.doAuthentication(StartActivity.MENDELEY_RETRIEVE_COLLECTION); return null; }/*from w w w .ja va 2s .c o m*/ String[] ids = null; try { String strResponse; if (col.m_coltype == MCollection.AUTHORED) { strResponse = connect("http://www.mendeley.com/oapi/library/documents/authored/?page=" + page + "&consumer_key=" + m_consumerkey); } else if (col.m_coltype == MCollection.LIBRARY) { strResponse = connect( "http://www.mendeley.com/oapi/library/?page=" + page + "&consumer_key=" + m_consumerkey); } else { strResponse = connect("http://www.mendeley.com/oapi/library/collections/" + col.id + "/?page=" + page + "&consumer_key=" + m_consumerkey); } Log.i("MendeleyComm", "Collection: " + col.id + "\n" + strResponse); JSONObject colData = new JSONObject(strResponse); JSONArray documents = colData.getJSONArray("document_ids"); ids = new String[documents.length()]; for (int i = 0; i < documents.length(); i++) { ids[i] = documents.getString(i); } // make sure we get all pages int totalpages = colData.getInt("total_pages"); if (page + 1 < totalpages) { String[] adddocs = getCollectionDocIDs(col, page + 1); String[] alldocs = new String[ids.length + adddocs.length]; for (int i = 0; i < ids.length; i++) alldocs[i] = ids[i]; for (int i = 0; i < adddocs.length; i++) alldocs[ids.length + i] = adddocs[i]; ids = alldocs; } } catch (Exception e) { Log.e("MendeleyConnector", "Got a " + e.getClass().getName() + ": " + e.getMessage()); } return ids; }
From source file:ch.lom.clemens.android.bibliography.data.JSONWebConnector.java
public String[] getGroupDocuments(MGroup group, int page) { if (!isConnected()) { StartActivity.singleton.doAuthentication(StartActivity.MENDELEY_RETRIEVE_COLLECTION); return null; }/* w w w . ja va2 s . c o m*/ String[] ids = null; try { String strResponse = connect("http://www.mendeley.com/oapi/library/groups/" + group.id + "/?page=" + page + "&consumer_key=" + m_consumerkey); Log.i("MendeleyComm", "Collection: " + group.id + "\n" + strResponse); JSONObject colData = new JSONObject(strResponse); JSONArray documents = colData.getJSONArray("document_ids"); ids = new String[documents.length()]; for (int i = 0; i < documents.length(); i++) { ids[i] = documents.getString(i); } // make sure we get all pages int totalpages = colData.getInt("total_pages"); if (page + 1 < totalpages) { String[] adddocs = getGroupDocuments(group, page + 1); String[] alldocs = new String[ids.length + adddocs.length]; for (int i = 0; i < ids.length; i++) alldocs[i] = ids[i]; for (int i = 0; i < adddocs.length; i++) alldocs[ids.length + i] = adddocs[i]; ids = alldocs; } } catch (Exception e) { Log.e("MendeleyConnector", "Got a " + e.getClass().getName() + ": " + e.getMessage()); } return ids; }
From source file:ch.lom.clemens.android.bibliography.data.JSONWebConnector.java
private MDocument parseDocumentResult(MDocument mdoc, String strResponse) throws JSONException { JSONObject doc = new JSONObject(strResponse); try {//from w w w . ja va 2s. c o m mdoc.title = doc.getString("title"); } catch (JSONException e) { Log.w("WebConnector", "Parsing error while getting document title"); } try { mdoc.year = doc.getString("year"); } catch (JSONException e) { Log.w("WebConnector", "Parsing error while getting document year"); } try { mdoc.notes = doc.getString("notes"); } catch (JSONException e) { Log.w("WebConnector", "Parsing error while getting document notes"); } try { mdoc.type = doc.getString("type"); } catch (JSONException e) { Log.w("WebConnector", "Parsing error while getting document type"); } try { mdoc.urls = new String[] { doc.getString("url") }; } catch (JSONException e) { Log.w("WebConnector", "Parsing error while getting document url"); } try { mdoc.pages = doc.getString("pages"); } catch (JSONException e) { Log.w("WebConnector", "Parsing error while getting document pages"); } try { mdoc.docabstract = doc.getString("abstract"); } catch (JSONException e) { Log.w("WebConnector", "Parsing error while getting document abstract"); } try { JSONArray authors = doc.getJSONArray("authors"); String[] strAuthors = new String[authors.length()]; for (int j = 0; j < authors.length(); j++) { strAuthors[j] = authors.getString(j); } mdoc.authors = strAuthors; } catch (JSONException e) { Log.w("WebConnector", "Parsing error while getting document authors"); } try { JSONArray tags = doc.getJSONArray("tags"); String[] mtags = new String[tags.length()]; for (int j = 0; j < tags.length(); j++) { mtags[j] = tags.getString(j); } mdoc.tags = mtags; } catch (JSONException e) { Log.w("WebConnector", "Parsing error while getting document tags"); } try { JSONObject ids = doc.getJSONObject("identifiers"); mdoc.identifiers = new HashMap<String, String>(); JSONArray names = ids.names(); for (int j = 0; j < names.length(); j++) { mdoc.identifiers.put(names.getString(j), ids.getString(names.getString(j))); } } catch (JSONException e) { Log.w("WebConnector", "Parsing error while getting document identifiers"); } try { JSONObject ids = doc.getJSONObject("discipline"); mdoc.discipline = new HashMap<String, String>(); JSONArray names = ids.names(); for (int j = 0; j < names.length(); j++) { mdoc.discipline.put(names.getString(j), ids.getString(names.getString(j))); } } catch (JSONException e) { Log.w("WebConnector", "Parsing error while getting document disciplines"); } return mdoc; }
From source file:gmc.hotplate.util.JsonParser.java
public Recipe parseRecipeObject(JSONObject obj) { Recipe recipe = null;//from ww w . j a v a 2 s . com try { int recipeId = obj.getInt(TAG_RECIPE_ID); String recipeName = obj.getString(TAG_RECIPE_NAME); String recipeDescription = obj.getString(TAG_RECIPE_DESCRIPTION); int personCount = obj.getInt(TAG_RECIPE_PERSON); JSONArray jsonSteps = obj.getJSONArray(TAG_RECIPE_STEPS); List<Step> steps = new ArrayList<Step>(); for (int i = 0; i < jsonSteps.length(); i++) { Step step = parseStepObject(jsonSteps.getJSONObject(i)); if (step != null) { steps.add(step); } } List<Ingredient> ingredients = new ArrayList<Ingredient>(); JSONArray jsonIngredients = obj.getJSONArray(TAG_RECIPE_INGREDIENTS); for (int i = 0; i < jsonIngredients.length(); i++) { Ingredient ingredient = parseIngredientObject(jsonIngredients.getJSONObject(i)); if (ingredient != null) { ingredients.add(ingredient); } } List<String> categories = new ArrayList<String>(); if (obj.has(TAG_RECIPE_CATEGORIES)) { JSONArray jsonCategories = obj.getJSONArray(TAG_RECIPE_CATEGORIES); for (int i = 0; i < jsonCategories.length(); i++) { String tag = jsonCategories.getString(i); categories.add(tag); } } recipe = new Recipe(recipeId, recipeName, recipeDescription, personCount, steps); recipe.setIngredients(ingredients); recipe.setCategories(categories); } catch (JSONException e) { Log.w(LOG_TAG, "ParseRecipe() error: " + e.getMessage()); } return recipe; }
From source file:org.schedulesdirect.grabber.ProgramTask.java
@Override public void run() { long start = System.currentTimeMillis(); DefaultJsonRequest req = factory.get(DefaultJsonRequest.Action.POST, RestNouns.PROGRAMS, clnt.getHash(), clnt.getUserAgent(), clnt.getBaseUrl()); try {// w w w. j a va 2s. c om JSONArray resp = Config.get().getObjectMapper().readValue(req.submitForJson(this.req), JSONArray.class); for (int i = 0; i < resp.length(); ++i) { JSONObject o = resp.getJSONObject(i); String id = o.optString("programID", "<unknown>"); if (!JsonResponseUtils.isErrorResponse(o)) { if (id.startsWith("EP")) seriesIds.add(Program.convertToSeriesId(id)); Path p = vfs.getPath(targetDir, String.format("%s.txt", id)); Files.write(p, o.toString(3).getBytes(ZipEpgClient.ZIP_CHARSET), StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE); } else if (JsonResponseUtils.getErrorCode(o) == ApiResponse.INVALID_PROGID || JsonResponseUtils.getErrorCode(o) == ApiResponse.PROGRAMID_QUEUED) { String msg = String.format("Missing program object: %s", id); if (!logMissingAtDebug) LOG.warn(msg); else LOG.debug(msg); if (retrySet != null) retrySet.add(id); } else throw new InvalidJsonObjectException("Error received for Program", o.toString(3)); } } catch (JSONException | JsonParseException e) { Grabber.failedTask = true; LOG.error("JSONError!", e); throw new RuntimeException(e); } catch (IOException e) { Grabber.failedTask = true; LOG.error("IOError receiving program data; filling in empty program info for non-existent program ids!", e); try { JSONArray ids = this.req; for (int i = 0; i < ids.length(); ++i) { String id = ids.getString(i); Path p = vfs.getPath(targetDir, String.format("%s.txt", id)); if (!Files.exists(p)) Files.write(p, Program.EMPTY_PROGRAM.getBytes(ZipEpgClient.ZIP_CHARSET)); } } catch (Exception x) { LOG.error("Unexpected error!", x); throw new RuntimeException(x); } } LOG.info(String.format("Completed ProgramTask in %dms [%d programs]", System.currentTimeMillis() - start, this.req.length())); }
From source file:com.google.blockly.model.FieldDropdown.java
/** * Loads a FieldDropdown from JSON. This is usually used for the {@link BlockFactory}'s * prototype instances./* w w w.j av a2 s . co m*/ * * @param json The JSON representing the object. * @return A new FieldDropdown instance. * @throws BlockLoadingException */ public static FieldDropdown fromJson(JSONObject json) throws BlockLoadingException { String name = json.optString("name"); if (TextUtils.isEmpty(name)) { throw new BlockLoadingException("field_dropdown \"name\" attribute must not be empty."); } JSONArray jsonOptions = json.optJSONArray("options"); ArrayList<Option> optionList = null; if (jsonOptions != null) { int count = jsonOptions == null ? 0 : jsonOptions.length(); optionList = new ArrayList<>(count); for (int i = 0; i < count; i++) { JSONArray option = null; try { option = jsonOptions.getJSONArray(i); } catch (JSONException e) { throw new BlockLoadingException("Error reading dropdown options.", e); } if (option != null && option.length() == 2) { try { String displayName = option.getString(0); String value = option.getString(1); if (TextUtils.isEmpty(value)) { throw new BlockLoadingException("Option values may not be empty"); } optionList.add(new Option(value, displayName)); } catch (JSONException e) { throw new BlockLoadingException("Error reading option values.", e); } } } } return new FieldDropdown(name, new Options(optionList)); }
From source file:com.phonegap.plugin.BluetoothPlugin.java
@Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) { Log.d(LOG_TAG, "Plugin Called"); this.callbackContext = callbackContext; PluginResult result = null;//from www. j a v a 2 s .c o 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; }