我在我的应用中遇到了Facebook集成问题。我实现了连接,它就像一个魅力,当我尝试向朋友发送请求时,通知不会显示在朋友的Facebook应用程序(或网站)中。我已按照本教程实施请求:https://developers.facebook.com/docs/android/send-requests/
我检查了我的哈希键,看起来是正确的。我已将android debug.keystore哈希键放在开发人员设置和应用程序哈希键中。我还禁用了沙箱模式并提供了正确的包名和类名。我到处寻找,似乎无法找到解决方案。
如果有人知道我的问题是什么,那就太棒了:)。
这是我的代码:
private void sendRequestDialog() {
Bundle params = new Bundle();
params.putString("message",
"Learn how to make your Android apps social");
final Session session = Session.openActiveSessionFromCache(mContext);
WebDialog requestsDialog = (new WebDialog.RequestsDialogBuilder(
mContext, session, params)).setOnCompleteListener(
new OnCompleteListener() {
@Override
public void onComplete(Bundle values,
FacebookException error) {
if (error != null) {
if (error instanceof FacebookOperationCanceledException) {
Toast.makeText(mContext, R.id.request_cancelled,
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(mContext, R.id.network_error,
Toast.LENGTH_SHORT).show();
}
} else {
final String requestId = values
.getString("request");
if (requestId != null) {
sendRequest(friend_facebook_id, session);
} else {
Toast.makeText(mContext, R.id.request_cancelled,
Toast.LENGTH_SHORT).show();
}
}
}
}).build();
requestsDialog.show();
}
protected void sendRequest(String friend_facebook_id, Session session) {
Bundle params = new Bundle();
params.putString("message",
"Learn how to make your Android apps social");
params.putString("to", friend_facebook_id);
WebDialog requestsDialog = (new WebDialog.RequestsDialogBuilder(
mContext, session, params)).setOnCompleteListener(
new OnCompleteListener() {
@Override
public void onComplete(Bundle values,
FacebookException error) {
if (error != null) {
if (error instanceof FacebookOperationCanceledException) {
Toast.makeText(mContext, "Request cancelled",
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(mContext, "Network Error",
Toast.LENGTH_SHORT).show();
}
} else {
final String requestId = values
.getString("request");
if (requestId != null) {
Toast.makeText(mContext, "Request sent",
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(mContext, "Request cancelled",
Toast.LENGTH_SHORT).show();
}
}
}
}).build();
requestsDialog.show();
}
由于