Hi,
I never got this to work on a real device, got the email but no
attachment, when installing K9 on a emulator and
then sending the email I see the mail in the outbox with a size of 0
bytes:
public static void sendFile(Context context) {
File exportDir = new
File(Environment.getExternalStorageDirectory(),
"file.csv");
if (!exportDir.exists()) {
exportDir.mkdirs();
}
String csvFile = exportDir + "/file.csv";
File file = new File(csvFile);
if(file.exists()) {
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "CSV file");
sendIntent.setType("text/csv");
//
sendIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
sendIntent.putExtra(Intent.EXTRA_STREAM,
Uri.parse("file:///sdcard/
mydir/file.csv"));
context.startActivity(Intent.createChooser(sendIntent,
"Send CSV
file"));
} else {
Util.displayToast(context, R.string.no_csv_file);
}
}
Anyone got it to work to send email with attachment?
Any help appreciated.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
To unsubscribe, reply using "remove me" as the subject.