Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 703
Jacek Kwiecień Avatar asked Dec 12 '12 20:12

Jacek Kwiecień


People also ask

What is intent message?

An intent is to perform an action on the screen. It is mostly used to start activity, send broadcast receiver,start services and send message between two activities. There are two intents available in android as Implicit Intents and Explicit Intents. Here is a sample example to start new activity with old activity.

How do I send intent from one app to another?

When you construct an intent, you must specify the action you want the intent to perform. Android uses the action ACTION_SEND to send data from one activity to another, even across process boundaries. You need to specify the data and its type.


1 Answers

    Intent intent = new Intent(Intent.ACTION_MAIN);     intent.addCategory(Intent.CATEGORY_APP_EMAIL);     startActivity(intent);       startActivity(Intent.createChooser(intent, getString(R.string.ChoseEmailClient))); 

That kinda worked. But it opend Gmail for me, even since I have other email clients

like image 90
Jacek Kwiecień Avatar answered Sep 28 '22 10:09

Jacek Kwiecień