我正在尝试使用来自 android 的 facebook sdk 发送请求。
我就是这样做的:
private void sendInviteRequestDialog() {
Bundle params = new Bundle();
params.putString("id", USER_ID);
params.putString("to", "xxxx");
showDialogWithoutNotificationBar("apprequests", params);
}
WebDialog requestsDialog = (
new WebDialog.RequestsDialogBuilder(HelloActivity.this,
Session.getActiveSession(),
params))
.setOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(Bundle values,
FacebookException error) {
if (error != null) {
if (error instanceof FacebookOperationCanceledException) {
Toast.makeText(HelloActivity.this.getApplicationContext(),
"Request cancelled",
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(HelloActivity.this.getApplicationContext(),
"Network Error",
Toast.LENGTH_SHORT).show();
}
} else {
final String requestId = values.getString("request");
if (requestId != null) {
Toast.makeText(HelloActivity.this.getApplicationContext(),
"Request sent",
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(HelloActivity.this.getApplicationContext(),
"Request cancelled",
Toast.LENGTH_SHORT).show();
}
}
}
})
.build();
requestsDialog.show();
所以,我登录了 fb,我可以看到我的朋友列表,在我的墙上发帖,但我无法发送邀请到我的应用程序的请求。在计算机上的网络浏览器中使用的相同 url 可以工作,但不能在 android 应用程序中使用。这是我收到的错误:
An error occured. Please try again later.
API Error code: 110
API Error Description: Invalid user id
Error Message: Missing user cookie(to validate session user)
我的权限是:
private static final List<String> PERMISSIONS = Arrays.asList(
"publish_actions", "publish_stream", "offline_access", "email",
"basic_info", "user_likes", "user_birthday", "status_update",
"create_note", "share_item", "user_status");
我此刻非常迷茫,不要明白这一点。任何想法都会很棒。谢谢你。