9

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

这是我在 strings.xml 资源中定义的 l10n 发送的文本:

<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>

请注意,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)));

game 是 Activity,context 是 Application 上下文,game_sharing_score_title 是“Share your score”活动的标题。无论如何,它自己的代码没有问题,它可以通过 Google+、WhatsUp 或 Twitter 共享,但是当用户选择通过 FaceBook 共享时,文本被剪裁,它只发布最后一个链接,其中包含信息和FB 从 Google Play 收集的一张图标图像,忽略链接前的所有文本。

很明显,问题出在 Facebook 上,与代码或字符串无关。

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

非常感谢提前,

4

1 回答 1

2
  1. 在您的帐户上创建 Facebook 应用程序
  2. 之后,您将获得 App id。
  3. 从 Facebook API 访问所有方法。
于 2012-09-21T04:40:15.063 回答