I have the following piece of code to check for supported intents. The code behaves as expected on the emulator when I check for email support. When I run the same on my actual devices HTC Wildfire and Samsung Galaxy Nexus, the isEmailSupported method returns false.
public static boolean isEmailSupported(Context context) {
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.putExtra(Intent.EXTRA_EMAIL, "example@example.com");
emailIntent.putExtra(Intent.EXTRA_TEXT, "Lorem ipsum...");
return isIntentSupported(context, emailIntent);
}
public static boolean isIntentSupported(Context context, Intent intent) {
PackageManager packageManager = context.getPackageManager();
List<ResolveInfo> intentActivities = packageManager.queryIntentActivities(
intent, PackageManager.MATCH_DEFAULT_ONLY);
return intentActivities != null && intentActivities.size() > 0;
}
Any pointers would be greatly appreciated. Thanks in advance.
Try adding the MIME type that you forgot to include in your
ACTION_SENDIntent. You must callsetType()with the MIME type of the content you are putting inEXTRA_TEXT(in this case, apparentlytext/plain).