0

我已经从我的应用程序启动了电子邮件活动..我的问题是我如何知道是否发送了电子邮件

try {

    Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
    emailIntent.setType("text/html"); 
    emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"Check out this play from http://www.iplaybook.net iPlayBook ");
    emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,"This play was created using<a href='http://www.iplaybook.net'> iPlayBook.</a>");
    final PackageManager pm = getPackageManager();
    @SuppressWarnings("static-access")
    final List<ResolveInfo> matches = pm.queryIntentActivities(emailIntent, pm.MATCH_DEFAULT_ONLY);
    ResolveInfo best = null;
    for (final ResolveInfo info : matches)
    {
        if (info.activityInfo.name.toLowerCase().contains("mail"))
            best = info;
    }
    if (best != null)
    {
        emailIntent.setClassName(best.activityInfo.packageName, best.activityInfo.name);
        startActivit(emailIntent);
    }
}
catch(Exception e) { }

}

请帮助..

4

1 回答 1

0

您无法从 android 确认电子邮件是否已发送。电子邮件的实际发送在设计上是异步的,因此活动可能会在电子邮件实际发送之前返回。

请在发布新问题之前搜索 SO 中的问题

干杯, RJ

于 2012-04-18T08:29:09.303 回答