I have been using below code to start an Intent
in Android to send an email. Prior to Android Lollipop (API level 21) this worked fine. Unfortunately, in Android Lollipop, this throws an "Unsupported Action" error.
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setType("message/rfc822");
intent.setData(Uri.parse("mailto:" + email));
startActivity(intent);
It's pretty basic, it simply passes the e-mailaddress and lets the user pick which application to use.
How should I adapt my code to make this work across api levels? My minimum API level is 16 (JellyBean).
Edit I've included the MIME-type, as per the comments and answers.