public static Bundle getQueryParamsForPlatformActivityIntentWebFallback( Context context, String callId, int version, String applicationName, Bundle methodArgs) { String keyHash = Settings.getApplicationSignature(context); if (Utility.isNullOrEmpty(keyHash)) { return null; } Bundle webParams = new Bundle(); webParams.putString(FALLBACK_DIALOG_PARAM_KEY_HASH, keyHash); webParams.putString(FALLBACK_DIALOG_PARAM_APP_ID, Settings.getApplicationId()); webParams.putInt(FALLBACK_DIALOG_PARAM_VERSION, version); webParams.putString(DIALOG_PARAM_DISPLAY, FALLBACK_DIALOG_DISPLAY_VALUE_TOUCH); Bundle bridgeArguments = new Bundle(); bridgeArguments.putString(NativeProtocol.BRIDGE_ARG_ACTION_ID_STRING, callId); bridgeArguments.putString(NativeProtocol.BRIDGE_ARG_APP_NAME_STRING, applicationName); methodArgs = (methodArgs == null) ? new Bundle() : methodArgs; try { JSONObject bridgeArgsJSON = BundleJSONConverter.convertToJSON(bridgeArguments); JSONObject methodArgsJSON = BundleJSONConverter.convertToJSON(methodArgs); if (bridgeArgsJSON == null || methodArgsJSON == null) { return null; } webParams.putString(FALLBACK_DIALOG_PARAM_BRIDGE_ARGS, bridgeArgsJSON.toString()); webParams.putString(FALLBACK_DIALOG_PARAM_METHOD_ARGS, methodArgsJSON.toString()); } catch (JSONException je) { webParams = null; Logger.log(LoggingBehavior.DEVELOPER_ERRORS, Log.ERROR, TAG, "Error creating Url -- " + je); } return webParams; }
private static void addAppLinkToMessage(UnityMessage unityMessage, AppLinkData appLinkData) { if (appLinkData == null) { unityMessage.put("did_complete", true); return; } unityMessage.put("ref", appLinkData.getRef()); unityMessage.put("target_url", appLinkData.getTargetUri().toString()); try { if (appLinkData.getArgumentBundle() != null) { unityMessage.put( "extras", BundleJSONConverter.convertToJSON(appLinkData.getArgumentBundle()).toString()); } } catch (JSONException ex) { Log.e(TAG, ex.getLocalizedMessage()); } }