react-native-receive-sharing-intent icon indicating copy to clipboard operation
react-native-receive-sharing-intent copied to clipboard

getAction() undefined because Android Intent is 'null'

Open davidsalib opened this issue 4 years ago • 3 comments

When sharing a file to the app, the intent is null. Thus, I get the error Attempt to invoke virtual method 'java.lang.String android.content.Intent.getAction()' on a null object reference - not sure why the intent is null. I reviewed the AndroidManifest.xml, and it seems to be correct for sharing files.

Here's the code in ReceiveSharingIntentModule.java that's sending the 'null' intent to 'sendFileNames':

  @ReactMethod
  public void getFileNames(Promise promise){
    Activity mActivity = getCurrentActivity();
    if(mActivity == null) { return; }
    Intent intent = mActivity.getIntent();
    receiveSharingIntentHelper.sendFileNames(reactContext, intent, promise);
    mActivity.setIntent(null);
  }

davidsalib avatar Sep 13 '21 07:09 davidsalib

Same issue here.

Kinqdos avatar Oct 28 '21 19:10 Kinqdos

same problem https://github.com/ajith-ab/react-native-receive-sharing-intent/issues/110#issuecomment-971612714

vlesu avatar Nov 17 '21 14:11 vlesu

@ajith-ab

mauris avatar Apr 23 '22 08:04 mauris