我正在使用适用于 Android 的 facebook sdk 3.0.1。我已按照教程进行操作,并且该应用程序运行良好。唯一的问题是,即使我的应用程序说请求已成功发送,也没有人收到我的请求。这是我的代码:
private void sendRequestDialog() {
Bundle params = new Bundle();
params.putString("message", "Learn how to make your Android apps social");
RequestsDialogBuilder requestsDialog = (new WebDialog.RequestsDialogBuilder(this,Session.getActiveSession(),params));
requestsDialog.setOnCompleteListener(new OnCompleteListener() {
public void onComplete(Bundle values,
FacebookException error) {
if (error != null) {
if (error instanceof FacebookOperationCanceledException) {
Toast.makeText(FacebookActivity.this.getApplicationContext(),
"Request cancelled",
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(FacebookActivity.this.getApplicationContext(),
"Network Error",
Toast.LENGTH_SHORT).show();
}
} else {
final String requestId = values.getString("request");
if (requestId != null) {
Toast.makeText(FacebookActivity.this.getApplicationContext(),
"Request sent",
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(FacebookActivity.this.getApplicationContext(),
"Request cancelled",
Toast.LENGTH_SHORT).show();
}
}
}
})
.build().show();
}'