I am trying to open up Gmail Compose screen when a button is clicked in my Android App. Do I need some API key for this from Google? or what do I need to do in my button onC
You just place below code inside your click event. Will open directly gmail as compose mode, Output screenshot attached below.
Happy coding :-)
code :
Intent intent=new Intent(Intent.ACTION_SEND);
String[] recipients={"mailto@gmail.com"};
intent.putExtra(Intent.EXTRA_EMAIL, recipients);
intent.putExtra(Intent.EXTRA_SUBJECT,"Subject text here...");
intent.putExtra(Intent.EXTRA_TEXT,"Body of the content here...");
intent.putExtra(Intent.EXTRA_CC,"mailcc@gmail.com");
intent.setType("text/html");
intent.setPackage("com.google.android.gm");
startActivity(Intent.createChooser(intent, "Send mail"));
Output :