views:

132

answers:

3

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?

A: 

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
How would you recommend doing this? Is there a wireshark type app for android?
fredley
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
A: 

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

HoratioCain
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
+1  A: 

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
Then why on earth does the app register to be able to recieve the ACTION_SEND Intent?
fredley
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
http://github.com/facebook/facebook-android-sdk
Jack Love
Basically your only route around this is the the Facebook SDK.
Jack Love