I need to implement the functionality of feedback
in Android, that the user to trigger the action is sent an email, with the app available, but pre-configured with the email to receive the email.
I need to implement the functionality of feedback
in Android, that the user to trigger the action is sent an email, with the app available, but pre-configured with the email to receive the email.
Searching for SO I've found the easiest solution.
The best option is to use compatibility library ShareCompat
to create the intent.
ShareCompat.IntentBuilder.from(activity)
.setType("message/rfc822")
.addEmailTo("[email protected]")
.setSubject("titulo del email")
.setText("cuerpo del mensaje")
//.setHtmlText(body) //Si se quiere usar HTML en el cuerpo del mensaje
.setChooserTitle("Enviar Feedback con")
.startChooser();
If you want to detect if there is a compatible app to send the email, replace the .startChooser()
with .createChooserIntent()
ShareCompat.IntentBuilder.from(activity)
.setType("message/rfc822")
.addEmailTo("[email protected]")
.setSubject("titulo del email")
.setText("cuerpo del mensaje")
//.setHtmlText(body) //Si se quiere usar HTML en el cuerpo del mensaje
.setChooserTitle("Enviar Feedback con")
.createChooserIntent();
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
} else { /*imposible enviar feedback*/}
If you want to know more about the ShareCompat
I leave tutorial Sharing Content The Easy Way using ShareCompat