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

Downloading and attaching an image on Android #93

Open
ptsimpso opened this issue Jan 12, 2021 · 2 comments
Open

Downloading and attaching an image on Android #93

ptsimpso opened this issue Jan 12, 2021 · 2 comments

Comments

@ptsimpso
Copy link

ptsimpso commented Jan 12, 2021

Providing a remote URL for image attachment works fine on iOS, but fails to attach an image on Android. I am attempting to use react-native-fetch-blob to download the image first, however when I try to provide the downloaded image file url, I get a "exposed beyond app through clipdata.item.geturi()" error.

Does anybody know how to properly download an image on Android and then provide it as an attachment?

My code:

const res = await RNFetchBlob.config({
                fileCache: true,
                appendExt: 'png',
              })
                .fetch('GET', shareImage);
              fileUrl = 'file://' + res.path();

const attachment = {
            url: fileUrl,
            iosType: 'public.png',
            iosFilename: 'Image.png',
            androidType: 'image/*'
          };

          SendSMS.send({
            body: shareText,
            recipients: [],
            successTypes: ['sent', 'queued'],
            allowAndroidSendWithoutReadPermission: true,
            attachment: attachment
          }, (completed, cancelled, error) => {
            console.log('SMS Callback: completed: ' + completed + ' cancelled: ' + cancelled + 'error: ' + error);
          });
@jenipharachel
Copy link

Hi @ptsimpso I'm facing a similar issue, I tried using react-native-fs to create a local storage for my images. Did you find a solution for this?

@Florido14
Copy link

hi i same the same issue, you find a solution? i try differents ways to solve this but i dont find any solution

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

3 participants