My Navigation Drawer includes an option to contact the developer via email. To do this I've included code in accordance with the documentation. However, when clicking on 'Contact Developer,' the options shown include my app, which is not capable of email. I've searched online for this issue but haven't found anything relevant. How do I limit the user's options to email-apps only? The method from MainActivity.java and intent-filter from AndroidManfiest are included below.
MainActivity.java
//METHOD: Allow user's to send email to developer
public void composeEmail() {
Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
emailIntent.setData(Uri.parse("mailto:")); // only email apps should handle this
emailIntent.putExtra(Intent.EXTRA_EMAIL, "contact@developer.com");
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Email subject");
if (emailIntent.resolveActivity(getPackageManager()) != null) {
startActivity(emailIntent);
}
}
AndroidManifest.xml
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme.Launcher">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!--Intent filter for sending email-->
<intent-filter>
<action android:name="android.intent.action.SENDTO" />
<data android:scheme="mailto" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>