如何使用以下代码捕获已发送或丢弃的电子邮件事件。
String mailId = "mygmailid@gmail.com";
Intent emailIntent = new Intent(Intent.ACTION_VIEW, Uri.fromParts("mailto", mailId, null));
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "My Subject");
String body = "Email body text";
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Body text here");
emailIntent.setClassName("com.google.android.gm", "com.google.android.gm.ComposeActivityGmail");
emailIntent.putExtra(Intent.EXTRA_TEXT, body);
startActivity(emailIntent);
try {
startActivityForResult(emailIntent, 1);
}
catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(dashboardActivity, "There is no gmail client installed.", Toast.LENGTH_SHORT).show();
}