Android OS makes it really easy to share an image programmatically, using the ACTION_SEND intent. I had a situation recently, while porting my
iBridalGown for iOS app to Android, where I wanted to send an email with multiple image attachments. As with most Android programming tasks, there were first a few snafus to overcome ;) A couple of the problems I was facing were:
- ACTION_SEND actually can only handle one image attachment.
- The images were saved in the "private" app directory (the one you get when you call getFilesDir()) , which is problematic when attaching images to emails this way.
- There are not many clients that respond to ACTION_SEND which can accommodate text/html content and an attachment, let alone multiple attachments
So, what did I do? Three problems, three solutions:
- I used the ACTION_SEND_MULTIPLE intent, in order to send multiple attachments.
- I made temporary copies of the images in external storage before attaching them to the intent.
- I made sure only Gmail would be launched, since it is the only app I found which can reliably handle sending text/html and multiple image attachments.
More details...