将publish_actions添加到适用于Android的Facebook应用

时间:2015-10-13 09:58:03

标签: android facebook facebook-graph-api facebook-android-sdk

我是一名Android开发者,我正在尝试创建Facebook应用程序,以便从Android应用程序在Facebook上分享,但我在如何将publish_actions添加到Facebook应用程序时遇到问题。

private static final String APP_ID = "XXXXXXXXXXXXXX";
private static final String[] PERMISSIONS = new String[] { "email", "user_photos", "publish_actions" };

并登录:

facebook.authorize(this, PERMISSIONS, Facebook.FORCE_DIALOG_AUTH, new LoginDialogListener());

发布:

try {
    Bundle parameters = new Bundle();
    parameters.putString("message", message);
    facebook.request("me");
    String response = facebook.request("me/feed", parameters, "POST");
    Log.w("Tests", "got response: " + response);
    if (response == null || response.equals("") || response.equals("false")) {
        Log.v("response", "Blank response.");
    } else {
        Log.v("response", "Message posted to your facebook wall!");
    }
} catch (Exception e) {
    e.printStackTrace();
    Log.w("Error", "Error1: " + e.toString());
}

我可以获得有关用户的所有信息但我不能在Facebook上发布

有人能帮助我吗?

0 个答案:

没有答案