当尝试从原生 Android 应用程序向 Facebook 发布活动时,我在执行请求后收到以下响应:
{
Response: responseCode: 200,
graphObject: null,
error: {
HttpStatus: -1,
errorCode: -1,
errorType: null,
errorMessage: null
},
isFromCache: false
}
我的应用程序从用户那里获得了 publish_action 权限。
public void publishActivity(){
session = Session.getActiveSession();
openSession();
Bundle params = new Bundle();
params.putString("highest", "http://www.my-url.com/graph.html");
Request request = new Request(
Session.getActiveSession(),
"me/namespace:play",
params,
HttpMethod.POST
);
Response response = request.executeAndWait();
Log.d("DEBUG",response.toString());
}
public void openSession(){
if(session.isClosed()){
Session.OpenRequest openRequest = new Session.OpenRequest(GameActivity.get());
openRequest.setPermissions(PERMISSIONS);
session.openForPublish(openRequest);
}
}
(我替换了 url 和命名空间。在我的代码中,它们是正确的。)