Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NullPointerException on some devices #151

Open
ggunti opened this issue Oct 20, 2022 · 5 comments
Open

java.lang.NullPointerException on some devices #151

ggunti opened this issue Oct 20, 2022 · 5 comments

Comments

@ggunti
Copy link

ggunti commented Oct 20, 2022

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.

Captură de ecran din 2022-11-30 la 12 23 03

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"
@fukemy
Copy link

fukemy commented Nov 18, 2022

any solution please

@GobindaSaha
Copy link

I'm facing the same problem.

@Mohammad-DH
Copy link

me too

@Mohammad-DH
Copy link

i cant even find the app in the share menu !

@esonetec
Copy link

@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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants