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
CodePudding user response:
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>
CodePudding user response:
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 "";
}
}