Reputation: 2308
I need to provide feature for users where users can share some data by sending email. I used below code.
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("text/html");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "testing email send.");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml("<b>this is html text in email body.</b>"));
startActivity(Intent.createChooser(emailIntent, "Email to Friend"));
This shows mail app, gmail and bluetooth for user to choose. I dont want user to show bluetooth in this list. What i need to do ? I have facebook app, which does same thing, but doesn't show bluetooth in the list. I need to do the same.
Upvotes: 17
Views: 19303
Reputation: 2189
Try using this type instead:
emailIntent.setType("message/rfc822");
Upvotes: 14
Reputation: 696
You can use the ACTION_SENTTO instead of ACTION_SEND to get the list of e-mail clients. I tried this on HTC Wildfire which had default e-mail client, GMail app and k9-3.508-release installed. When I ran your code with ACTION_SENDTO, I got list of above mentions 3 e-mail clients and not bluetooth no matter if bluetooth was enabled or disabled. I tried it both when the bluetooth was enabled and when bluetooth was disabled. It worked well for me.
Intent emailIntent = new Intent(android.content.Intent.ACTION_SENDTO);
emailIntent.setType("text/html");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "testing email send.");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml("<b>this is html text in email body.</b>"));
startActivity(Intent.createChooser(emailIntent, "Email to Friend"));
Upvotes: 15
Reputation: 12628
Try adding the EXTRA_EMAIL to your intent, maybe bluetooth can be connected to ACTION_SEND but not to the same action if an email is to be send.
See here:
http://developer.android.com/reference/android/content/Intent.html#ACTION_SEND
and here
http://developer.android.com/reference/android/content/Intent.html#EXTRA_EMAIL
Just a rough guess ...
Upvotes: 1