I am trying to send an email with a PDF attachment using the SocialSharing native plugin. It brings up the sharing alert and I select gmail, but then when it goes to gmail I see a toast error saying “permission denied for the attachment”. The email subject, body, etc are all filled in correctly.
I save the file using the File native plugin, to the cordova.file.externalApplicationStorageDirectory location (Android/data/[app-id]/Document.pdf), then pass that filename to the SocialSharing.shareViaEmail function.
File.writeFile(cordova.file.externalApplicationStorageDirectory, 'Document.pdf', blob, { replace: true })
.then((file) => {
SocialSharing.shareViaEmail('body', 'subject', ['to@test.com'], [], [], [cordova.file.externalApplicationStorageDirectory + '/Document.pdf']);
})