react-native-receive-sharing-intent
react-native-receive-sharing-intent copied to clipboard
getAction() undefined because Android Intent is 'null'
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);
}
Same issue here.
same problem https://github.com/ajith-ab/react-native-receive-sharing-intent/issues/110#issuecomment-971612714
@ajith-ab