So, from my Android app, I can send emails with the app in Gmail. In Outlook, it looks like it is attaching a file (.txt), but when I open the mail, there is no attached file.
This is my code:
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
Uri uriFileToShare = Uri.fromFile(file);
emailIntent.setType("plain/text");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, file.getName());
emailIntent.putExtra(android.content.Intent.EXTRA_STREAM, uriFileToShare);
this.startActivityForResult(Intent.createChooser(emailIntent, activity.getString(R.string.send)+" "+file.getName()+" "+activity.getString(R.string.by_email)),code);
I tried different solutions, but no result.
The file, of course, exists and is not empty. As I said, Gmail is connected correctly.
Any idea?
source
share