jeudi 21 mai 2015

Android intent not showing only email clients

So I'm trying to launch a prepopulated email client with data. The content gets populated fine, however my problem is that when launching the intent, I wanted it to only show email clients to select from. Instead, it shows Gmail, Adding to EverNote, Android Beam, Bluetooth, and some others.

I don't know if its an issue with lollipop that broke this functionality or not, as one of my managers sent me code that worked fine for him a few years ago.

My code is:

  private void openEmailClient(){
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("message/rfc822");

intent.putExtra(Intent.EXTRA_EMAIL, new String[]{getResources().getString(R.string.contact_feedback_email_address)});
intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.contact_feedback_email_subject_android));

try{
startActivity(Intent.createChooser(intent,intentEmailString));
} catch(android.content.ActivityNotFoundException ex){
  Log.e(EMAIL_FAIL_TAG, EMAIL_FAIL);
  ex.printStackTrace();
}
  }

Aucun commentaire:

Enregistrer un commentaire