[英]Test publish permissions for Facebook app
I want to test the publish permissions for my facebook app, however when using the graph api(s) to either like or comment, I get an error from the facebook server. 我想测试我的Facebook应用程序的发布权限,但是当使用图形API进行点赞或评论时,我从Facebook服务器收到错误消息。
The code being used to post a like is as below: 用于发布赞的代码如下:
Bundle params = new Bundle();
params.putString("url", "http://www.imdb.com/title/tt2015381/");
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/" + facebookObjectId + "/likes",
params,
HttpMethod.POST,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
Log.i(TAG, "FACEBOOK GRAPH RESPONSE FOR POSTING LIKE: " + response);
}
}
).executeAsync();
The corresponding error that is being generated is: 正在生成的相应错误是:
FACEBOOK GRAPH RESPONSE FOR POSTING LIKE: {Response: responseCode: 403, graphObject: null, error: {HttpStatus: 403, errorCode: 200, errorType: OAuthException, errorMessage: (#200) App does not have permission to make this call}}
essentially suggesting that App does not have permission to make this call 本质上暗示该应用无权进行此调用
To post custom like: 要发布自定义,例如:
Bundle params = new Bundle();
params.putString("object", linkURL);
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/" + Profile.getCurrentProfile().getId() + "/og.likes",
params,
HttpMethod.POST,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
Log.i(TAG, "FACEBOOK GRAPH RESPONSE FOR POSTING LIKE: " + response);
}
}
).executeAsync();
To delete custom like: 要删除自定义,例如:
Bundle params = new Bundle();
params.putString("object", linkURL);
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/" + likeActionInstanceId,
params,
HttpMethod.DELETE,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
Log.i(TAG, "FACEBOOK GRAPH RESPONSE FOR DELETING LIKE: " + response);
}
}
).executeAsync();
Here the likeActionInstanceId
is the id
received after submitting the like successfully. 这里
likeActionInstanceId
是成功提交like之后收到的id
。
NOTE : Comments can't be added as of now from your own app. 注意 :目前无法通过您自己的应用添加评论。 Comment Mirroring is in beta phase at Facebook.
评论镜像在Facebook处于测试阶段。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.