Share downloaded image

I’m succesfully using the Share Module for text. Now I’m trying to share image files. My app lists a number of images (as it does the News feed example) which are downloaded and saved somewhere in the phone (I’m using Android). I would like to know if with the Share module I can share the actual image that has been downloaded. I can’t find where Android saves the images to get the path. Inside the apps folder there’s only the folder /cache which is empty.

The following works fine if I want to share the URL:

share.shareText(some_URL, some_text);

But what should I do if I want, for example, to add the image to a WhatsApp message? If I try with:

share.shareFile(image.path, "image/*", some_text);

will not work if for image.path I use the URL, nor it will work if for image.path I use the name of image file only.

Do I have to download explicitly the image and then use the FileSystem module to get the full path or I can retrieve the already downloaded image path somewhere? And, will this work on iOS too?

Regards.

Enrico wrote:

Do I have to download explicitly the image and then use the FileSystem module to get the full path or I can retrieve the already downloaded image path somewhere? And, will this work on iOS too?

Yes, you need to download the image and store it on the phone. And yes, it’s [pretty much] the same on iOS.

One thing to keep in mind is that the image should be saved in a place where all other apps on the phone have read access to it. If you saved the file in your apps’ data directory, other apps would not be able to read it, so you wouldn’t be able to share it.

Understood. You are right, the image should be placed where all the apps have read access. I would not have thought about it.

I have did the same thing as the above but seems to not working with me. It says on the phone ‘Faild to Add Image’ and I didn’t find my image in the Camera Roll. Keep in mind that I’m doing this on preview only not a release !!

@GFlakes: please create a new forum post and don’t hijack older threads.

Also, make sure you include a complete, minimal reproduction that we could copy-paste and run to see the problem in action.