How to filter specific apps for ACTION_SEND intent (and set a different text for each app)

How can you filter out specific apps when using the ACTION_SEND intent? This question has been asked in various ways, but I haven’t been able to gather a solution based on the answers given. Hopefully someone can help. I would like to provide the ability to share within an app. Following Android Dev Alexander Lucas’ advice, I’d prefer to do it using intents and not using the Facebook/Twitter APIs.

Sharing using ACTION_SEND intent

Sharing using the ACTION_SEND intent is great, but the problem is (1) I don’t want every sharing option there, I’d rather limit it to FB, Twitter, and Email, and (2) I don’t want to share the same thing to each sharing app. For example, in my twitter share I’m going to include some mentions and hashtags limited it to 140 chars or less, while the facebook share is going to include a link and a feature image.

Is it possible to limit the options for ACTION_SEND (share) intent? I’ve seen something about using PackageManager and queryIntentActivities, but haven’t been able to figure out the connection between the PackageManager and the ACTION_SEND intent.

OR

Rather than filter the sharing apps, my problem could also be solved if I could use the ACTION_SEND intent to go directly to facebook or twitter rather than popping up the dialog. If that were the case then I could create my own dialog and when they click “Facebook” create a Facebook-specific intent and just send them all the way to Facebook. Same with Twitter.

OR is it not possible? Are the Facebook and Twitter APIs the only way?

12 Answers
12

Leave a Comment