How can I get an event of gmail if email is sent or not in android. I've tried the below but could not achieve the result
Intent helpIntent = new Intent(Intent.ACTION_SEND);
helpIntent.setData(Uri.parse("mailto:"));
helpIntent.setType("message/rfc822");
helpIntent.setPackage("com.google.android.gm");
helpIntent.putExtra(Intent.EXTRA_EMAIL, new String[] {"xyz@gmail.com"});
helpIntent.putExtra(Intent.EXTRA_SUBJECT, "Mail Subject");
helpIntent.putExtra(Intent.EXTRA_TEXT, " TEXT BODY");
startActivityForResult(helpIntent,1);
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 1)
{
if (resultCode == RESULT_OK)
{
Toast.makeText(this, "SENT", Toast.LENGTH_SHORT).show();
}
else
{
Toast.makeText(this, "DISCARD", Toast.LENGTH_SHORT).show();
}
}
}