I want to make tweet/share buttons for gamers. They will make them able to write some tweets or share the gained score in the wall.

I found this code:

String shareBody = "Share text";
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject Here");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody);
startActivity(Intent.createChooser(sharingIntent, "Test"));

This code is quite good. For the Twitter app, the text is sent correctly. ("Share text") But it doesn't work for the facebook app.

Where is the error?

Thanks in advance!

有帮助吗?

解决方案

You have no error - it's simply impossible.

Facebook is limiting the "share via intent" to display only the hyperlinks if exists. you can't display any regular text.

The only way to do that is to make a full facebook connect (Facebook's Android SDK) and ask post-to-wall permissions from user.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top