Skip to content Skip to sidebar Skip to footer

Force Android To Pick An App For Email Sending

I implemented sending emails from my application. I used this quesion on SO as a guide to achieve this, note that in the answers someone said to use setType('message/rfc822'); beca

Solution 1:

query applications, get a list of applications which are register to send action and choose one, create an intent, set class name and start your intent and you're done

Solution 2:

if you wish to find which apps can handle the intent , you can use:

getPackageManager().queryIntentActivities...

when you find the app that you wish , set the package of the intent to match the one of the app.

Solution 3:

Intentemail=newIntent(Intent.ACTION_SEND);
email.setType("text/plain");
email.putExtra(Intent.EXTRA_EMAIL,  "" );

email.putExtra(Intent.EXTRA_SUBJECT, "");

email.putExtra(Intent.EXTRA_TEXT, prsnname + " :   "+ data  +"\n\n" +  linkdata);


try
{

activity.startActivity(Intent.createChooser(email, "Send mail..."));

}
catch (android.content.ActivityNotFoundException ex) 
{
    Toast.makeText(activity, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
}

Post a Comment for "Force Android To Pick An App For Email Sending"