EddyVerbruggen / SocialSharing-PhoneGap-Plugin

👨‍❤️‍💋‍👨 Cordova plugin to share text, a file (image/PDF/..), or a URL (or all three) via the native sharing widget
MIT License
1.78k stars 908 forks source link

Unable to attach a file located in the app's local filesystem to an email #924

Open mc-sm opened 6 years ago

mc-sm commented 6 years ago

We’re using cordova-plugin-file to create a file in the app’s local filesystem. More specifically, the file is created in /data/data/<app-id>/files/Documents, which is in the Documents folder under cordova.file.dataDirectory as per https://github.com/apache/cordova-plugin-file/blob/master/README.md#android-file-system-layout.

When using cordova-plugin-email-composer, we’re able to successfully attach the file to an email by referencing it with app://files/Documents/fileName.txt.

However, when using cordova-plugin-x-socialsharing, we are unable to successfully attach the file using app://files/Documents/fileName.txt and various other permutations of the path. The email client (Gmail) displays “Can’t attach empty file” or “Permission denied for the attachment”.

Can anyone advise on the specific path that can be used to reach the file using cordova-plugin-x-socialsharing? Any suggestions or guidance is appreciated. Thanks!

mc-sm commented 6 years ago

This issue may be related to #814.

jfoclpf commented 3 years ago

Hi @mc-sm maybe too late, but I had exactly the same problem.

In this plugin, contrary to the cordova-plugin-email-composer the file path must be complete, for example files: [cordova.file.dataDirectory + 'myimg.jpg']. I like more the way the files path are dealt here, it's more clear and in accordance with the file paths of cordova-plugin-file

jfoclpf commented 3 years ago

IMHO I think this issue may be closed because it's just a question of files path. Actually this plugin is better with that respect.