问题
I am starting Email client using intent from my activity (Either native email or gmail). I just want to get notified into my activity when user presses send button or discards the email. I just want to start another activity when user press send button and want to show a dialog when user discards the email.
Here is my code
Intent emailIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
emailIntent.setType("message/rfc822");
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] {"email@something.com"});
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Test Mail");
emailIntent.putExtra(Intent.EXTRA_TEXT, "Test Mail Subject");
startActivityForResult(emailIntent, REQ_CODE);
public void onActivityResult(int requestCode, int resultCode,
Intent data) {
if(requestCode == REQ_CODE){
Toast.makeText(getApplicationContext(), "resultCode "+resultCode, Toast.LENGTH_LONG).show();
//if(resultCode == RESULT_OK){
//}
}
}
Thanks in Advance..
回答1:
This is not possible. ACTION_SEND
is not designed for use with startActivityForResult()
, and nobody, let alone whatever email client the user happens to choose, is obligated to call setResult()
to let you know what the user did.
来源:https://stackoverflow.com/questions/15786215/how-to-get-notified-for-send-or-cancel-of-an-email