react-native-receive-sharing-intent
react-native-receive-sharing-intent copied to clipboard
java.lang.NullPointerException on some devices
In my app I allowed to share images (jpeg, png) and pdf files.
Image sharing is working properly. But on some android devices (ex. Huawei mate 10 lite) when I try to share a pdf file, I simply get "java.lang.NullPointerException" in the error callback function. On some another devices it just simply works.

What could cause this error on some android devices? And why only regarding pdf sharing? (as I mentioned, image sharing works always on all devices).
I added these filters to the AndroidManifest.xml
file:
<!-- Add this filter, if you want to support sharing png images into your app-->
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/png" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/png" />
</intent-filter>
<!-- Add this filter, if you want to support sharing jpg and jpeg images into your app-->
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/jpeg" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/jpeg" />
</intent-filter>
<!-- Add this filter, if you want to support sharing pdf files into your app-->
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/pdf" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/pdf" />
</intent-filter>
And these permissions:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
"react": "17.0.2",
"react-native": "0.68.2",
"react-native-receive-sharing-intent": "^2.0.0"
any solution please
I'm facing the same problem.
me too
i cant even find the app in the share menu !
@Mohammad-DH: Try adding the following intent to android/app/main/AndroidManifest.xml:
<intent-filter> <action android:name="android.intent.action.SEND" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="text/plain" /> <data android:mimeType="image/*" /> <!-- Any other mime types you want to support --> </intent-filter>