I think, therefore I blog

How To Remove The Facebook Android Sharing Intent

By , 2 May 2014

How To Remove The Facebook Android Sharing Intent
How To Remove The Facebook Android Sharing Intent

I don't really care why Facebook made a mess of their Android sharing intent. Other developers have already pointed out that their iOS sharing works fine, but their Android product only allows you to share URLs and not text. My guess is they are trying to force developers onto their API because, you know, force makes people so much more motivated and creative and all that.


The real problem is that it makes your app look broken, and fortunately there is a simple solution:

Dump Facebook.

Just cut and paste the code below to launch your share intents and Facebook will not be listed as an option. That way you won't look bad when their share page comes up blank.

How To Remove The Facebook Android Sharing Intent
    // get available share intents
    List<Intent> targets = new ArrayList<Intent>();
    Intent template = new Intent(Intent.ACTION_SEND);
    List<ResolveInfo> candidates = this.getPackageManager().
	  queryIntentActivities(template, 0);

    // remove facebook which has a broken share intent
    for (ResolveInfo candidate : candidates) {
        String packageName = candidate.activityInfo.packageName;
        if (!packageName.equals("com.facebook.katana")) {
	  Intent target = new Intent(android.content.Intent.ACTION_SEND);
	  target.putExtra(Intent.EXTRA_TEXT, "Text to share"));
    Intent chooser = Intent.createChooser(targets.remove(0), translate("Share Via"));
    chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, targets.toArray(new Parcelable[]{}));

About Roger Keays

How To Remove The Facebook Android Sharing Intent

Roger Keays is an artist, an engineer, and a student of life. Since he left Australia in 2009, he has been living as a digital nomad in over 40 different countries around the world. Roger is addicted to surfing. His other interests are music, psychology, languages, and finding good food. Click here to subscribe to his weekly blog, or stalk him on Facebook and Twitter.

Leave a Comment

Please visit https://RogerKeays.com/how-to-remove-the-facebook-android-sharing-intent to add your comments.

Comment posted by: Nirodha, 7 months ago

Thank you buddy.

Comment posted by: goofy, last year

Thanks a lot for this... dumb facebook

Comment posted by: Simon, last year

Very helpful, thanks a lot !

Join 3,559 People Who Think Outside The Box

I write every Sunday about travel, psychology, technology, and all sorts of interesting stuff. It's completely free, and you can subscribe for as long as you like. Do it now, so you don't miss a single post.

Chat For A While

Your Vote Matters

Which Tech Company is the Creepiest?