diff --git a/package.json b/package.json index d09e574..9e4d22f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-plugin-customurlscheme", - "version": "4.1.2", + "version": "4.1.3", "description": "Launch your app by using this URL: mycoolapp://, you can add a path and even pass params like this: mycoolerapp://somepath?foo=bar", "cordova": { "id": "cordova-plugin-customurlscheme", diff --git a/plugin.xml b/plugin.xml index f9ef9d8..f62d237 100755 --- a/plugin.xml +++ b/plugin.xml @@ -1,8 +1,8 @@ + id="nl.x-services.plugins.launchmyapp" + version="4.1.3"> Custom URL scheme diff --git a/src/android/nl/xservices/plugins/LaunchMyApp.java b/src/android/nl/xservices/plugins/LaunchMyApp.java index d6b073b..74d0165 100644 --- a/src/android/nl/xservices/plugins/LaunchMyApp.java +++ b/src/android/nl/xservices/plugins/LaunchMyApp.java @@ -25,13 +25,17 @@ public class LaunchMyApp extends CordovaPlugin { public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { if (ACTION_CLEARINTENT.equalsIgnoreCase(action)) { final Intent intent = ((CordovaActivity) this.webView.getContext()).getIntent(); - intent.setData(null); + // Telerik LiveSync needs the data object as well, see /pull/3 in the Telerik Verified Plugins fork + final String intentString = intent.getDataString(); + if (intentString == null || !intentString.contains("platform.telerik.com")) { + intent.setData(null); + } return true; } else if (ACTION_CHECKINTENT.equalsIgnoreCase(action)) { final Intent intent = ((CordovaActivity) this.webView.getContext()).getIntent(); final String intentString = intent.getDataString(); if (intentString != null && intent.getScheme() != null) { - lastIntentString = intentString; + lastIntentString = intentString; callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, intent.getDataString())); } else { callbackContext.error("App was not started via the launchmyapp URL scheme. Ignoring this errorcallback is the best approach."); @@ -54,7 +58,10 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo public void onNewIntent(Intent intent) { final String intentString = intent.getDataString(); if (intentString != null && intent.getScheme() != null) { - intent.setData(null); + // Telerik LiveSync needs the data object as well, see /pull/3 in the Telerik Verified Plugins fork + if (!intentString.contains("platform.telerik.com")) { + intent.setData(null); + } try { StringWriter writer = new StringWriter(intentString.length() * 2); escapeJavaStyleString(writer, intentString, true, false);