从Android应用程序在Facebook上发布高分

Ben*_*ung 1 android facebook

我只是在Eclipse Android中完成了类似Mastermind的游戏应用程序.我现在想要的是让用户在他/她的Facebook帐户上发布他/她的分数.在AlertDialog构建器中,当用户选择"发布到我的Facebook"按钮时,它应该能够真正做到.实际代码非常感谢!

干杯

Ovi*_*tcu 6

如果你想特别使用,Facebook你应该使用FacebookSDK for Android.

但据我所知,这可能会给你带来很多问题,而我建议你做一个Share Intent让用户选择在哪里得分:

    Intent shareIntent=new Intent(Intent.ACTION_SEND);
    shareIntent.setType("text/plain");
    shareIntent.putExtra(Intent.EXTRA_TEXT,"Your score and Some extra text");
    shareIntent.putExtra(Intent.EXTRA_SUBJECT, "The title");
    startActivity(Intent.createChooser(shareIntent, "Share..."));
Run Code Online (Sandbox Code Playgroud)

这将允许用户从他的手机上安装的更多应用程序中进行选择,例如Facebook,Twitter ......等.