I'm working on an Android dependency service to open the default email client and add an image attachment.
I'm passing an ImageSource object to the Android dependency service, but now I'm trying to add the ImageSource object being passed as an attachment in an email message. I've been researching this but all of the solutions I've found are reading from an actual file in the disk (see here)
This is what I have so far...
public void OpenEmailClient(ImageSource image)
{
Intent email = new Intent(Android.Content.Intent.ActionSend);
email.PutExtra(Android.Content.Intent.ExtraSubject, "Catalog page image");
email.SetType("message/rfc822");
// I'm trying to get the uri from the ImageSource object here...
var uri = image.GetValue(UriImageSource.UriProperty);
// The line below is giving an error - the uri variable is invalid
email.PutExtra(Intent.ExtraStream, uri);
Forms.Context.StartActivity(Intent.CreateChooser(email, "Send mail..."));
}
Am I going to have to save the image in disk in order to be able to attach it to an email message?
Any ideas?