Bundle params = new Bundle();
params.putString("to", useriId);
params.putString("message","Hello World");
WebDialog requestsDialog = (new WebDialog.RequestsDialogBuilder(
JoinVia.this, Session.getActiveSession(), params))
.setOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(Bundle values,
FacebookException error) {
if (error != null) {
if (error instanceof FacebookOperationCanceledException) {
Toast.makeText(
JoinVia.this.getApplicationContext(),
"Request cancelled", Toast.LENGTH_SHORT)
.show();
} else {
Toast.makeText(
JoinVia.this.getApplicationContext(),
"Network Error", Toast.LENGTH_SHORT)
.show();
}
} else {
final String requestId = values
.getString("request");
if (requestId != null) {
Toast.makeText(
JoinVia.this.getApplicationContext(),
"Request sent", Toast.LENGTH_SHORT)
.show();
} else {
Toast.makeText(
JoinVia.this.getApplicationContext(),
"Request cancelled", Toast.LENGTH_SHORT)
.show();
}
}
}
}).build();
requestsDialog.show();
这是我向朋友 ID 发送邀请的代码。该代码可以发送通知,但是当我从浏览器单击通知图标时,邀请不存在。谁能指导我如何向朋友 facebook 发送消息。