diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.java index 6a84f50cd..8139797ae 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.java @@ -86,16 +86,15 @@ public class IntentModule extends ReactContextBaseJavaModule { getReactApplicationContext().getPackageManager()); String otherPackageName = (componentName != null ? componentName.getPackageName() : ""); - // Always add the FLAG_ACTIVITY_NEW_TASK if we are launching to a different package - if (!selfPackageName.equals(otherPackageName)) { + // If there is no currentActivity or we are launching to a different package we need to set + // the FLAG_ACTIVITY_NEW_TASK flag + if (currentActivity == null || !selfPackageName.equals(otherPackageName)) { intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); } if (currentActivity != null) { currentActivity.startActivity(intent); } else { - // If no currentActivity, we want to always start a new task regardless of logic above - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); getReactApplicationContext().startActivity(intent); }