Jacek KwiecieĊ„ Jacek KwiecieĊ„ - 2 months ago 6
Android Question

Opening email client via Intent (but not to send a message)

Is there a way to programically open email client, without a need to forcing message send? I just want the app to let user open his email client for email checking purposes :)

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("message/rfc822");
startActivity(Intent.createChooser(intent, ""));


This code works but it forces user to send a new message.

Answer

I think you should replace Intent.ACTION_SEND to Intent.ACTION_VIEW,
i am sure this will work as this will prompt with list of application which support MIME type "message/rfc822" so it will include your default email client in your device other than gmail app.

How about this code:

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

}