7

I'm adding the ability to share scores from my app using android's share intent:

Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "My Score");
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "I scored "+score+" on "+difficultyString+" difficulty.");

context.startActivity(Intent.createChooser(shareIntent, "Share your score"));

When I choose Facebook from the chooser, it goes to m.facebook.com and says "Your link could not be shared". What's going wrong here?

fredley
  • 32,953
  • 42
  • 145
  • 236

5 Answers5

2

This is a common problem found in all android apps when trying to share to facebook. Facebook blocks other applications from sharing using their app. I'm not sure why, but many companies are trying to bypass this. Currently, it is "unfix-able". Sorry.

Jack Love
  • 726
  • 3
  • 11
  • 17
  • Then why on earth does the app register to be able to recieve the ACTION_SEND Intent? – fredley Oct 21 '10 at 23:49
  • 1
    Beats me. Seems like they should remove this feature. I hope Facebook will listen to the Android developers and allow using their Share feature from other apps. But yet again, I'm not sure why they even have it in the first place. You could look into the Facebook SDK and see if you could use that instead. – Jack Love Oct 21 '10 at 23:51
  • Basically your only route around this is the the Facebook SDK. – Jack Love Oct 22 '10 at 00:29
  • Facebook's Eric Tseng confirmed to me on Twitter today that they're looking to fix this. Here's hoping the next release of the app correctly accepts shared text. – Ollie C May 11 '11 at 12:50
2

I found out that you can use this URL to share something to facebook:

http://www.facebook.com/sharer.php?s=100&p[title]=YOUR_TITLE_HERE&p[summary]=YOUR_SUMMARY_HERE&p[url]=YOUR_URL_TO_POINT_TO_WHEN_THIS_IS_BEEING_CLICKED

This does not require the user to have facebook installed

runely
  • 21
  • 1
2

Dude, you can try this:

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, the_pure_link);
startActivity(Intent.createChooser(intent, "Share with"));

If there is images inside the_pure_link, or the_pure_link contains:

<link rel="image_src" type="image/jpeg" href="image_address" />

The facebook share will show the link, with the image, and your comment together. All these solutions are find from stackoverflow.com. Check it here:

Share Text on Facebook from Android App via ACTION_SEND

Image share from android to facebook

Community
  • 1
  • 1
James
  • 5,119
  • 5
  • 25
  • 27
0

My universal idea in such siturations is to sniff traffic between android & server and see what exactly been sent to the server when you run this code. The you can compare it to something which works, and this would give your some ideas.

BarsMonster
  • 6,483
  • 2
  • 34
  • 47
  • How would you recommend doing this? Is there a wireshark type app for android? – fredley Oct 20 '10 at 09:29
  • You can do it using wireshark if you connect both your PC and WiFi router to the dumb hub, so that you will be able to sniff Android's packets on your PC. – BarsMonster Oct 20 '10 at 10:01
0

Your intent code looks fine - have you tried installing a different FB app?

HoratioCain
  • 915
  • 9
  • 19
  • Well the code works fine with other apps like twitter, but no luck with the official fb app, which i assume is the one most people have... – fredley Oct 22 '10 at 00:11