1

My Android 4+ app offers the user the possibility to setup a new user account for a web service. Once the user has sent the registration data, the new account is created and needs to be confirmed by clicking on a link which is sent to the user's e-mail address.

To make the registration as smooth as possible I would like to offer a "Go to your mail inbox" button once the data was submitted.

In iOS I can use the message:// URL scheme to do this. When my app calls such an URL iOS automatically switches to the Mail app.

How can this be done on Android?

Of course, I know about new Intent(Intent.ACTION_SEND)... to create and send a new mail but this is not what I am looking for. The user should not send an e-mail but check his inbox for new emails.

EDIT:

This is not a duplicate of the linked question since this is not about starting a specific app (e.g. "com.google.android.gm") but the systems default mail app.

Andrei Herford
  • 16,250
  • 19
  • 84
  • 193

2 Answers2

4

You can use the following:

Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_APP_EMAIL);
getActivity().startActivity(intent);

From the documentation:

Used with ACTION_MAIN to launch the email application. The activity should be able to send and receive email.

André Sousa
  • 1,652
  • 1
  • 12
  • 23
1

You could use Intent.ACTION_VIEW like below:

final Intent emailLauncher = new Intent(Intent.ACTION_VIEW);
emailLauncher.setType("message/rfc822");
try{
       startActivity(emailLauncher);
}catch(ActivityNotFoundException e){

}
navylover
  • 10,374
  • 5
  • 24
  • 34