When clicking an email address from a browser or contacts app...
Is there any way for my app to show a mail client in the intent list?
When clicking an email address from a browser or contacts app...
Is there any way for my app to show a mail client in the intent list?
As you can see from the Mail application's source, having your application catch the intent is as simple as adding the intent-filter
to your AndroidManifest.xml
inside your mail composition activity
definition.
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.SENDTO" />
<data android:scheme="mailto" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
You can see that the <data>
tag specifies to handle mailto:
links. The BROWSABLE
category means it can be launched from the browser.
K-9 Mail is similar, except using the SENDTO
action only with the DEFAULT
category, and the VIEW
action only with the BROWSABLE
category.
You need to use an Intent Filter
. Check out http://developer.android.com/guide/topics/intents/intents-filters.html for more information. You usually declare these in your manifest file. The intent I believe you're looking for is Intent.ACTION_SEND
.