1
can send an email with a suggestion directly from the App, without opening an external application, like Gmail? Example:
A field where one puts the email and another field it by the suggestion and a send button. After all the fill when she touches the send button, the email is fired, without opening the default email application that is configured on the smartphone?
I did a test with the code below, it works however it opens the external application.
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Envie sua sugestão para o nosso email", Snackbar.LENGTH_LONG)
.setAction("Enviar", new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent email = new Intent(Intent.ACTION_SEND);
email.setData(Uri.parse("mailto"));
email.setType("message/rfc822");
email.putExtra(Intent.EXTRA_EMAIL,
new String[]{"aquieucolocomeuemaildecontato"});
email.putExtra(Intent.EXTRA_SUBJECT,
"Sugestão: ");
email.putExtra(Intent.EXTRA_TEXT, "Olá " + "");
startActivity(Intent.createChooser(email, "ENVIAR E-MAIL"));
}
}).show();
}
});
}
Follow this tutorial and you will be able to send email directly from the app without having to use other external applications. link
– Henqsan
@Henqsan visualized here, I will test later but already helped here. Thank you
– Flávio