'How to say Android my app is an email client app?
I have developed a little email client app, only to send an email to some contacts But I don't know how to say Android that my app is an email client. When I click on the email address of my contact, android let me choose to open Gmail or Aquamail (my 2 app installed from Google store), but not my app.
I guess I have to add something in my Manifest file, but I didn't find
Thanks for your help
Solution 1:[1]
Put these intent filters in the Manifest in activity section.
<intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.SEND"/>
<data android:mimeType="*/*"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<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>
<intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.SEND_MULTIPLE"/>
<data android:mimeType="*/*"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
Solution 2:[2]
OK, it was almost good, but now I cannot get my email address when I click on it Here's my code,
String recupIndent () {
Bundle bundle = getIntent().getExtras();
if (bundle != null) {
return bundle.getStringArray(Intent.EXTRA_EMAIL)[0];
} else {
return "";
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Yamin Yazdanpanah |
| Solution 2 | Dududu13 |
