0

我希望能够从我的 android 应用程序中分享帖子,但我无法实现。我已将 facebook sdk 3.0 添加到我的应用程序中。我可以获得用户名、用户名、用户名等。但我无法发送提要。下面是我使用的代码:

Bundle postParams = new Bundle();
postParams.putString("name", "Facebook SDK for Android");
postParams.putString("caption", "Build great social apps and get more installs.");
postParams.putString("description", "The Facebook SDK for Android makes it easier and faster to develop Facebook integrated Android apps.");
postParams.putString("link", "https://developers.facebook.com/android");
postParams.putString("picture", "https://raw.github.com/fbsamples/ios-3.x-howtos/master/Images/iossdk_logo.png");

Request.Callback callback= new Request.Callback() {
    public void onCompleted(Response response) {
                        Log.e("Sonuc", "Geldi");
    }
};

Request request = new Request(session, "me/feed", postParams, HttpMethod.POST, callback);
RequestAsyncTask task = new RequestAsyncTask(request);
task.execute();

此片段来自 https://developers.facebook.com/docs/howtos/androidsdk/3.0/publish-to-feed/

当我执行此代码时,它会在成功完成时记录下来。我的意思是 Request.Callback 的 onComplete 方法可以正常工作。没有其他内容被记录为错误。我不明白为什么它不起作用?它与发布权限有关吗?

这个片段有什么问题?

4

1 回答 1

0

也许您忘记获得“publish_actions”的许可?

private boolean isSubsetOf(Collection<String> subset, Collection<String> superset) {
for (String string : subset) {
    if (!superset.contains(string)) {
        return false;
    }
}
return true;
}

if (!isSubsetOf(PERMISSIONS, permissions)) {
        pendingPublishReauthorization = true;
        Session.NewPermissionsRequest newPermissionsRequest = new Session
                .NewPermissionsRequest(this, PERMISSIONS);
    session.requestNewPublishPermissions(newPermissionsRequest);
        return;
    }
于 2014-01-16T02:22:13.627 回答