我正在使用适用于 Facebook 的 Android SDK v3.0 向朋友发送使用我的应用程序的请求。我使用在这里看到的代码打开 Facebook 的 Dialog 应用程序并向用户的朋友发出请求。
使用以下代码显示并发送请求后。我现在收到“请求已发送”祝酒词,但从未发送过请求。
private void sendRequestDialog() {
Bundle params = new Bundle();
params.putString("message", "MESSAGE");
params.putString("app_id", "APPID");
WebDialog requestsDialog = (
new WebDialog.RequestsDialogBuilder(LoginActivity.this,
Session.getActiveSession(),
params))
.setOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(Bundle values,
FacebookException error) {
if (error != null) {
if (error instanceof FacebookException) {
Toast.makeText(LoginActivity.this.getApplicationContext(),
"Request cancelled",
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(LoginActivity.this.getApplicationContext(),
"Network Error",
Toast.LENGTH_SHORT).show();
}
} else {
final String requestId = values.getString("request");
if (requestId != null) {
Toast.makeText(LoginActivity.this.getApplicationContext(),
"Request sent",
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(LoginActivity.this.getApplicationContext(),
"Request cancelled",
Toast.LENGTH_SHORT).show();
}
}
}
})
.build();
requestsDialog.show();
}
在 Request Dialog 的显示过程中,从 Logcat 获取以下日志:
03-15 17:18:51.944: W/dalvikvm(2842): disableGcForExternalAlloc: false
03-15 17:18:53.759: V/chromium(2842): external/chromium/net/base/bandwidth_metrics.h:96: [0315/171853:INFO:bandwidth_metrics.h(96)] Bandwidth: 1500.13Kbps (avg 2275.13Kbps)
03-15 17:18:54.124: W/dalvikvm(2842): disableGcForExternalAlloc: false
03-15 17:18:58.019: W/dalvikvm(2842): disableGcForExternalAlloc: true
03-15 17:18:58.629: W/dalvikvm(2842): disableGcForExternalAlloc: false
03-15 17:18:58.684: W/dalvikvm(2842): disableGcForExternalAlloc: true
03-15 17:18:59.314: W/dalvikvm(2842): disableGcForExternalAlloc: false
03-15 17:18:59.369: W/dalvikvm(2842): disableGcForExternalAlloc: true
03-15 17:18:59.949: W/dalvikvm(2842): disableGcForExternalAlloc: false
03-15 17:18:59.954: W/dalvikvm(2842): disableGcForExternalAlloc: true
03-15 17:19:00.534: W/dalvikvm(2842): disableGcForExternalAlloc: false
03-15 17:19:00.539: W/dalvikvm(2842): disableGcForExternalAlloc: true
03-15 17:19:01.329: W/dalvikvm(2842): disableGcForExternalAlloc: false
03-15 17:19:03.459: W/dalvikvm(2842): disableGcForExternalAlloc: true
03-15 17:19:03.984: W/dalvikvm(2842): disableGcForExternalAlloc: false
03-15 17:19:04.019: W/dalvikvm(2842): disableGcForExternalAlloc: true
03-15 17:19:04.189: W/dalvikvm(2842): disableGcForExternalAlloc: false
03-15 17:19:06.269: W/dalvikvm(2842): disableGcForExternalAlloc: false
03-15 17:19:10.869: I/NONPRIME(2842): <CallBackProxy> Send to WebViewClient.
请指出我正确的方向...