I am trying to send an email with an attachment, but it seems to be erroring out:
private void sendEmail(File pictureFile){
Uri uri = Uri.fromFile(pictureFile);
Date dt = new Date();
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_EMAIL , new String[]{"a@gmail.com", "b@gmail.com"});
i.putExtra(Intent.EXTRA_SUBJECT, "Google Glass Capture");
i.putExtra(Intent.EXTRA_TEXT , "Taken "+ dt.toString());
i.putExtra(Intent.EXTRA_STREAM, uri);
try {
Log.d("Msg","Trying to send mail");
startActivity(Intent.createChooser(i,"pick"));
} catch (android.content.ActivityNotFoundException ex) {
Log.e("ERR","Error " + ex.toString());
Toast.makeText(MainActivity.this,
"There are no email clients installed.",
Toast.LENGTH_SHORT).show();
}
}
Is there a different way to send mail with google glass then that of android?