private void getHandlers(JSONObject message) throws JSONException { final Intent intent = GeckoAppShell.getOpenURIIntent( activity, message.optString("url"), message.optString("mime"), message.optString("action"), message.optString("title")); final List<String> appList = Arrays.asList(GeckoAppShell.getHandlersForIntent(intent)); final JSONObject response = new JSONObject(); response.put("apps", new JSONArray(appList)); EventDispatcher.sendResponse(message, response); }
@Override public void onActivityResult(int resultCode, Intent data) { JSONObject response = new JSONObject(); try { if (data != null) { response.put("extras", JSONUtils.bundleToJSON(data.getExtras())); response.put("uri", data.getData().toString()); } response.put("resultCode", resultCode); } catch (JSONException e) { Log.w(LOGTAG, "Error building JSON response.", e); } EventDispatcher.sendResponse(message, response); }