I am trying to open email sending form of Gmail directly on button click but this always shows a list of options for sending email.
I am doing this for opening GMail form:
Intent emailIntent = new Intent( android.content.Intent.ACTION_SEND);
String[] recipients = new String[]{"" , "" ,};
emailIntent.putExtra( android.content.Intent.EXTRA_EMAIL, recipients);
emailIntent.putExtra( android.content.Intent.EXTRA_SUBJECT, "This is my text" );
emailIntent.putExtra( android.content.Intent.EXTRA_TEXT, "");
emailIntent.setType("message/rfc822");
startActivity( Intent.createChooser(emailIntent, "Send Email" ));
but this is not opening GMail form. What can i do for opening GMail form please help.
Is there any way to do this?
Clear Cache and Data for Gmail Sometimes residual cache files get corrupted and cause the app to malfunction. When you are experiencing the problem of Gmail not sending emails on Android, you can always try clearing the cache and data for the app.
Step 1: Open your Gmail account. Step 2: Click on the Compose box to type the email you would like to send to multiple recipients from your Gmail. Step 3: After writing the email, click on the BCC option besides the CC option.
Open the Gmail app . Settings. Tap your account. Make sure the box next to "Sync Gmail" is checked.
use something on the lines
public void sendGmail(Activity activity, String subject, String text) {
Intent gmailIntent = new Intent();
gmailIntent.setClassName("com.google.android.gm", "com.google.android.gm.ComposeActivityGmail");
gmailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
gmailIntent.putExtra(android.content.Intent.EXTRA_TEXT, text);
try {
activity.startActivity(gmailIntent);
} catch(ActivityNotFoundException ex) {
// handle error
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With