Android Send Public Storage File Via Email
I have looked at many, many SO posts to find an answer, but no luck... How do I send a file from public storage as an e-mail attachment? Most posts are asking about internal storag
Solution 1:
So it seems really bizarre for my app to set up a FileProvider with access permissions for a public file
The app that you are trying to send it through may not have external storage access. Hence, FileProvider
is still the recommended pattern.
This causes the app to crash with the message: "MyApp has stopped"
Use LogCat to examine the Java stack trace associated with the crash in whatever app "MyApp" is.
Also, please note that plain/text
is not a valid MIME type. Presumably you mean text/plain
.
And, given a File
, use Uri.fromFile()
to generate a Uri
for it. Bear in mind that your app may crash on Android 7.0+ for using a file
scheme, though, which is another reason for using FileProvider
.
What is the right way to do this?
Use FileProvider
.
Post a Comment for "Android Send Public Storage File Via Email"