diff --git a/android/libs/arm64-v8a/libti.deeply.so b/android/libs/arm64-v8a/libti.deeply.so index 51e56b3..b8a8f10 100644 Binary files a/android/libs/arm64-v8a/libti.deeply.so and b/android/libs/arm64-v8a/libti.deeply.so differ diff --git a/android/libs/armeabi-v7a/libti.deeply.so b/android/libs/armeabi-v7a/libti.deeply.so index e9bcf0b..b7f67ac 100644 Binary files a/android/libs/armeabi-v7a/libti.deeply.so and b/android/libs/armeabi-v7a/libti.deeply.so differ diff --git a/android/libs/x86/libti.deeply.so b/android/libs/x86/libti.deeply.so index 85d90de..b525b46 100644 Binary files a/android/libs/x86/libti.deeply.so and b/android/libs/x86/libti.deeply.so differ diff --git a/android/src/ti/deeply/DeepLinkHandlerActivity.java b/android/src/ti/deeply/DeepLinkHandlerActivity.java index 71e1d0f..3ba0e66 100644 --- a/android/src/ti/deeply/DeepLinkHandlerActivity.java +++ b/android/src/ti/deeply/DeepLinkHandlerActivity.java @@ -4,6 +4,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; +import android.net.Uri; import android.os.Bundle; import android.util.Log; @@ -40,20 +41,21 @@ private void processIntent(Intent intent) { try { TiDeeplyModule module = TiDeeplyModule.getModule(); Context context = getApplicationContext(); - String data = intent.getDataString(); + Uri data = intent.getData(); String action = intent.getAction(); Bundle extras = intent.getExtras(); Intent launcherIntent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName()); - launcherIntent.addCategory(Intent.CATEGORY_LAUNCHER); - launcherIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (module.hasCallback() && KrollRuntime.getInstance().getRuntimeState() != KrollRuntime.State.DISPOSED) { module.sendDeepLink(data, action, extras); } else { - launcherIntent.putExtra(TiDeeplyModule.INTENT_DATA, data); - launcherIntent.putExtra(TiDeeplyModule.INTENT_ACTION, action); - launcherIntent.putExtra(TiDeeplyModule.INTENT_EXTRAS, extras); + launcherIntent.addCategory(Intent.CATEGORY_LAUNCHER); + launcherIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + launcherIntent.setData(data); + launcherIntent.setAction(action); + launcherIntent.putExtras(intent); + launcherIntent.putExtra(TiDeeplyModule.EXTRA_DEEPLY_FLAG, true); } startActivity(launcherIntent); diff --git a/android/src/ti/deeply/TiDeeplyModule.java b/android/src/ti/deeply/TiDeeplyModule.java index 64f72e1..359c840 100644 --- a/android/src/ti/deeply/TiDeeplyModule.java +++ b/android/src/ti/deeply/TiDeeplyModule.java @@ -18,6 +18,7 @@ import org.appcelerator.titanium.TiApplication; import android.content.Intent; +import android.net.Uri; import android.os.Bundle; import org.appcelerator.kroll.common.Log; @@ -32,9 +33,7 @@ public class TiDeeplyModule extends KrollModule private static final String LCAT = "ti.deeply.TiDeeplyModule"; private static final boolean DBG = TiConfig.LOGD; - public static final String INTENT_DATA = "tideeply.data"; - public static final String INTENT_ACTION = "tideeply.action"; - public static final String INTENT_EXTRAS = "tideeply.extras"; + public static final String EXTRA_DEEPLY_FLAG = "tideeply.isDeepLink"; private static TiDeeplyModule module = null; @@ -56,31 +55,27 @@ public static TiDeeplyModule getModule() { public void parseBootIntent() { try { Intent intent = TiApplication.getAppRootOrCurrentActivity().getIntent(); - String data = intent.getStringExtra(INTENT_DATA); - String action = intent.getStringExtra(INTENT_ACTION); - Bundle extras = intent.getBundleExtra(INTENT_EXTRAS); - - if (data != null) { - sendDeepLink(data, action, extras); - intent.removeExtra(INTENT_DATA); - intent.removeExtra(INTENT_ACTION); - intent.removeExtra(INTENT_EXTRAS); + Boolean deeplyFlag = intent.getBooleanExtra(EXTRA_DEEPLY_FLAG, false); + + if (deeplyFlag == true) { + intent.removeExtra(EXTRA_DEEPLY_FLAG); + sendDeepLink(intent.getData(), intent.getAction(), intent.getExtras()); } else { - Log.d(LCAT, "Empty data in Intent"); + Log.d(LCAT, "Not started by a deep link."); } } catch (Exception ex) { Log.e(LCAT, "parseBootIntent" + ex); } } - public void sendDeepLink(String data, String action, Bundle extras) { + public void sendDeepLink(Uri data, String action, Bundle extras) { if (callback == null) { Log.e(LCAT, "sendDeepLink invoked but no callback defined"); return; } HashMap e = new HashMap(); - e.put("data", data); // to parse on reverse on JS side + e.put("data", data.toString()); // to parse on reverse on JS side e.put("action", action); e.put("extras", convertBundleToMap(extras));