I want to add some photo files to an e-mail intent. The intent is starting normally.
Problem: The attachment is not showing up e.g. in the GMail application. I do not receive any error message. Where could be the issue?
I have changed my code along with the suggestions in this post but my code still does not seem to work.
The file path that I receive from the photo object: file:///storage/emulated/0/Pictures/SMSCloudImages/IMG_20161127_121011.jpg
It should be a correct path because I can show the images in a gallery.
Uri uri = Uri.parse("mailto:" + "someone@mail.com")
.buildUpon()
.appendQueryParameter("subject", subject)
.appendQueryParameter("body", body)
.build();
List<Photo> photoList = new ArrayList<>();
photoList.addAll(databaseHandler.getPhotos(qReport.getId()));
Intent emailIntent = new Intent(Intent.ACTION_SENDTO, uri);
Intent intentPick = new Intent();
intentPick.setAction(Intent.ACTION_PICK_ACTIVITY);
intentPick.putExtra(Intent.EXTRA_TITLE, getResources().getString(R.string.q_report_launch_mail_text));
intentPick.putExtra(Intent.EXTRA_INTENT, emailIntent);
for (Photo photo: photoList) {
intentPick.putExtra(Intent.EXTRA_STREAM, Uri.parse(photo.getName()));
}
this.startActivityForResult(intentPick, REQUEST_CODE_MY_PICK);