如何获得通知的发送或电子邮件的取消 [英] How to get notified for send or cancel of an email
问题描述
我使用的意图,从我的活动(无论是本机电子邮件或Gmail)启动电子邮件客户端。我只想得到通知到我的活动时用户presses发送按钮或丢弃电子邮件。我只是想开始在用户preSS发送按钮,并希望当用户放弃电子邮件显示一个对话框另一个活动。
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.
下面是我的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..
推荐答案
这是不可能的。 ACTION_SEND
不是设计用于 startActivityForResult()
,和任何人,更不用说任何电子邮件客户端的用户恰好选择,有义务叫的setResult()
来让你知道用户做了什么。
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.
这篇关于如何获得通知的发送或电子邮件的取消的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!