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

Attachments are not working on Android #84

Open
fatihmerickoc opened this issue Mar 19, 2022 · 5 comments
Open

Attachments are not working on Android #84

fatihmerickoc opened this issue Mar 19, 2022 · 5 comments

Comments

@fatihmerickoc
Copy link

I am trying to send email with attachment. When i build the code in Ios it runs with no error and perfectly but whenever i try to run in Android i got no errors but Gmail says "File could not be attached".
Please Help!!

@grumblebear
Copy link

If you look at the sources, you will notice that this package has its own idea, how your attachments should be organized.
The following ling is the problem:
FileProvider.getUriForFile(activity!!, activity!!.packageName + ".file_provider", File(it))
That is a bad idea. The code should simply assume, that the user passes a correct content uri. So I propose to rename the parameter attachmentPaths to attachmentUris and leave this alone.
Further I see, all attachments will get the content type "application/octet-stream". One should be able to pass the correct mime type.

@MichalOneNav
Copy link

Is there workaround? There is fix in 5.2.0 but not working.

@tony-soft
Copy link

Same problem here!

@voivoed
Copy link

voivoed commented Oct 24, 2023

@grumblebear what would you change on the code you mentioned above? I'm not versed in Kotlin and I'm having a hard time getting this plugin to work on Android 13. I get the attachment error message on some devices but not on others and I can't figure out why. Unfortunately none of my devices cause the errors so debugging this on my subscribers' devices is impossible.

@voivoed
Copy link

voivoed commented Oct 27, 2023

@sidlatau could you please look into this? This package is not working on all Android 13 devices. Unfortunately I don't have the technical expertise to fix it myself. I've tried using both single PDF file attachment and multiple file attachments, a TXT and PDF.

The files appear attached on the email composer window, but when the user taps the send button, the PDF file fails to attach with the message "File could not be attached" and the emails end up on the Draft folder instead of being sent out. The TXT file gets attached, it's just the PDF file that is consistently missing.

I found out that if the user changes anything on the email, either changing subject or body text (even by just adding a space somewhere) or selects a different account to email from the dropdown, the email goes through fine with all attachments. The problem only happens if the send button is tapped on the composer screen without anything having been changed in the email the plugin put together.

Unfortunately I can't reproduce the issue in any of my own devices, I'm working with some users that are having this problem. I tested this with my sister and her boyfriend, both have 2 identical phones with the same Android 13 version installed, configured pretty much the same, but the email attachments work in one phone but not the other.

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