diff --git a/android/src/main/java/com/reactnativereceivesharingintent/ReceiveSharingIntentModule.java b/android/src/main/java/com/reactnativereceivesharingintent/ReceiveSharingIntentModule.java index f752144..d204ccd 100644 --- a/android/src/main/java/com/reactnativereceivesharingintent/ReceiveSharingIntentModule.java +++ b/android/src/main/java/com/reactnativereceivesharingintent/ReceiveSharingIntentModule.java @@ -18,6 +18,7 @@ public class ReceiveSharingIntentModule extends ReactContextBaseJavaModule { private final ReactApplicationContext reactContext; private ReceiveSharingIntentHelper receiveSharingIntentHelper; + private Intent oldIntent; public ReceiveSharingIntentModule(ReactApplicationContext reactContext) { super(reactContext); @@ -30,6 +31,7 @@ public ReceiveSharingIntentModule(ReactApplicationContext reactContext) { protected void onNewIntent(Intent intent) { Activity mActivity = getCurrentActivity(); if(mActivity == null) { return; } + oldIntent = mActivity.getIntent(); mActivity.setIntent(intent); } @@ -40,7 +42,9 @@ public void getFileNames(Promise promise){ if(mActivity == null) { return; } Intent intent = mActivity.getIntent(); receiveSharingIntentHelper.sendFileNames(reactContext, intent, promise); - mActivity.setIntent(null); + if (oldIntent != null) { + mActivity.setIntent(oldIntent); + } } @ReactMethod