Write the data to a file in your own application directory usingHowever, this setup fails to work with the Gmail. When you try to share with Gmail in this manner, an error message pops up in the logs:
getFileStreamPath()can be used to return a
File. As with the previous option,
Uri.fromFile()will create a
Urifor your share intent.
file:// attachment paths must point to file:///mnt/sdcard. Ignoring attachment file:///data/data/com.idunnolol.ragefaces/files/share.pngI'm not sure why Gmail arbitrarily rejects attachments not on the SD card, but it pretty much cuts you off from sharing files with MODE_WORLD_READABLE. Unfortunately sharing with Gmail feels like an essential part of the app so I'm going to have to stick with SD card sharing.