Facebook在使用ACTION_SEND意图时在Android上剪辑文本

Fra*_*zoa 9 java android facebook

我在我的休闲游戏中添加了代码,通过社交网络,电子邮件等分享最高分.

对于l10n,这是我在strings.xml资源上定义的文本:

<string name="game_sharing_score" formatted="false">
    My new High Score on Gamename: %d\n
    You can download Gamename from here:\n
    https://play.google.com/store/apps/details?id=gamepackage
</string>
Run Code Online (Sandbox Code Playgroud)

请注意,Gamename和gamepackage不是我正在使用的实际游戏包.

共享代码如下:

    String shareScoreMsg = String.format(context.getString(R.string.game_sharing_score), highestScore);
    Intent shareScoreInt = new Intent(Intent.ACTION_SEND);
    shareScoreInt.setType("text/plain");
    shareScoreInt.putExtra(Intent.EXTRA_TEXT, shareScoreMsg);

    game.startActivity(Intent.createChooser(shareScoreInt, context.getString(R.string.game_sharing_score_title)));
Run Code Online (Sandbox Code Playgroud)

游戏是一个Activity,context是一个Application上下文,game_sharing_score_title是活动的标题"Share your score".无论如何,它自己的代码没有任何问题,它可以通过Google+,WhatsUp或Twitter进行分享,但是当用户选择通过FaceBook共享时,文本被剪切并且只发布最后一个链接,包含信息和FB从Google Play收集的一个图标图像,忽略链接之前的所有文本.

很明显,问题只在于Facebook,没有代码或字符串.

我想要找到的是某种解决方法,如果存在,以避免这些FB问题.说实话,我不喜欢Facebook,但它是一个拥有数百万人的社交网络,我不能简单地在游戏中忽略它.

非常感谢提前,

sac*_*n10 2

  1. 在您的帐户上创建 Facebook 应用程序
  2. 之后,您将获得应用程序 ID。
  3. 从 Facebook API 访问所有方法。