Bhabani Shankar
Bhabani Shankar

Reputation: 1285

Android Intent.ACTION_SEND for all sharable applications

I have an application where I want to share some text data using either gmail/google+/facebook/bluetooth or any sharable application.

I have following code in my application.

final Intent emailIntent = new Intent(Intent.ACTION_SEND); 

emailIntent.setType("plain/text");
emailIntent.putExtra(Intent.EXTRA_TEXT, "Test Data");
startActivity(Intent.createChooser(emailIntent, "Select Application"));

But it is showing Gmail and bluetooth only. Not other installed apps like google+

Upvotes: 0

Views: 655

Answers (3)

Akshay
Akshay

Reputation: 5765

Only those apps will be visible that register for the plain/text mime type. It seems Google+ doesn't.

Upvotes: 1

Mischa
Mischa

Reputation: 632

You can do a few things to include google+ with the other apps in the chooser.

emailIntent.setType("text/*");

'text/*' will open all apps set to handle text mimetypes including text/plain and text/html


emailIntent.setType("*/*");

If you really want 'all sharable apps' ... This code will literally open everything possible. However, you'll find that you have more than one choice for certain apps like Facebook... but it is worth experimenting with to reveal all of the apps possible for the chooser.


emailIntent.setType("text/plain");

Google+ and most other apps do work with "text/plain" on my galaxy tab, but it makes some of them ignore the pictures.. note that "plain/text" is backwards and incorrect.

Note: On my app I resorted to having more than one share button, since I needed to use "image/jpg" for MMS to work, and "text/plain" for just about everything else...

Upvotes: 0

user711058
user711058

Reputation: 715

Akshay is right. Change MIME type to emailIntent.setType("text/plain"); and you will get much more options.

Upvotes: 2

Related Questions