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
291 stars 105 forks source link

[Error: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getAction()' on a null object reference] #180

Open DarshanKSPL opened 7 months ago

DarshanKSPL commented 7 months ago

I'm trying to build an application that will receive shared Excel files using react native. I have used this "react-native-receive-sharing-intent" to receive files but every time I get the below message.

[Error: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getAction()' on a null object reference]

I have followed each installation & configuration step mentioned in https://ajith-ab.github.io/react-native-receive-sharing-intent/docs/android.

Issue: There is one more issue with this dependency is when the app is open and then I click on a home screen & open the file manager, select the file, click on the share option & then select my app to open the file so it opens the application but I can't get new latest shared file data in ReceiveSharingIntent.getReceivedFiles() method.

bhagwandas commented 7 months ago

I am also facing the same issue.

It's working fine for sharing text, issue is only with sharing files.

Here is the error message:

Error: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getAction()' on a null object reference at Object.promiseMethodWrapper [as getFileNames] (index.bundle?platform=android&dev=true&minify=false&app=com.merasamaj&modulesOnly=false&runModule=t…:4729:36) at ReceiveSharingIntentModule.getFileNames (index.bundle?platform=android&dev=true&minify=false&app=com.merasamaj&modulesOnly=false&runModule=t…:127915:32) at ReceiveSharingIntentModule.getReceivedFiles (index.bundle?platform=android&dev=true&minify=false&app=com.merasamaj&modulesOnly=false&runModule=t…:127895:35) at ShowNotifications. (index.bundle?platform=android&dev=true&minify=false&app=com.merasamaj&modulesOnly=false&runModule=t…:213226:52) at Generator.next () at asyncGeneratorStep (index.bundle?platform=android&dev=true&minify=false&app=com.merasamaj&modulesOnly=false&runModule=t…:21144:26) at _next (index.bundle?platform=android&dev=true&minify=false&app=com.merasamaj&modulesOnly=false&runModule=t…:21163:11) at index.bundle?platform=android&dev=true&minify=false&app=com.merasamaj&modulesOnly=false&runModule=t…:21168:9 at tryCallTwo (index.bundle?platform=android&dev=true&minify=false&app=com.merasamaj&modulesOnly=false&runModule=t…:25573:7) at doResolve (index.bundle?platform=android&dev=true&minify=false&app=com.merasamaj&modulesOnly=false&runModule=t…:25704:15)

Arshad-Ali-1a commented 5 months ago

I am facing the same issue..

ramachandrach-Kore commented 2 weeks ago

Please follow these steps, particularly in MainActivity.java https://ajith-ab.github.io/react-native-receive-sharing-intent/docs/android