ajith-ab / react-native-receive-sharing-intent

A React Native plugin that enables React Native apps to receive sharing photos, videos, text, urls or any other file types from another app
MIT License
297 stars 108 forks source link

getAction() undefined because Android Intent is 'null' #96

Open davidsalib opened 3 years ago

davidsalib commented 3 years ago

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);
  }
Kinqdos commented 2 years ago

Same issue here.

vlesu commented 2 years ago

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

mauris commented 2 years ago

@ajith-ab