I'm trying send email from my app using standard gmail app. But I get chooser all the time. How can I open standard gmail app immediately without chooser? I don't need a chooser with any application which can send email. I need only GMAIL. Thank you! Here is my code.
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("message/rfc822");
intent.setClassName("com.google.android.gm", "com.google.android.gm.ConversationListActivity");
intent.putExtra(Intent.EXTRA_EMAIL , new String[]{"mymail@gmail.com"});
intent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
intent.putExtra(Intent.EXTRA_TEXT , "Text");
try {
startActivity(intent);
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(getApplicationContext(), "There are no email clients installed.", Toast.LENGTH_SHORT).show();
}
Please check this question, it will helps you mainly the third answer because of this note, It is important to note that if you are going to use this code, you check to make sure that the user has the package "com.google.android.gm" installed on their device. In any language, make sure to check for null on specific Strings and initializations.
Intent URI to launch Gmail App
You need to use the ACTION.SENDTO intent if you want to use GMail app and not the chooser. You will also add the extras in the URI text and not on the intent.
Can you try this code.