我想在Facebook上通过我的应用程序发布。到目前为止,我已经能够创建一个具有必要权限的活动会话,但是当我点击共享按钮时,Facebook对话框会弹出,保持完全黑暗几秒钟并关闭。
以下是我能够提取的错误消息
01-02 15:18:07.537: W/System.err(14344): com.facebook.FacebookDialogException
01-02 15:18:07.537: W/System.err(14344): at com.facebook.widget.WebDialog$DialogWebViewClient.onReceivedSslError(WebDialog.java:396)
01-02 15:18:07.537: W/System.err(14344): at com.android.webview.chromium.WebViewContentsClientAdapter.onReceivedSslError(WebViewContentsClientAdapter.java:699)
01-02 15:18:07.537: W/System.err(14344): at com.android.org.chromium.android_webview.AwContentsClientBridge.allowCertificateError(AwContentsClientBridge.java:61)
01-02 15:18:07.537: W/System.err(14344): at com.android.org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
01-02 15:18:07.537: W/System.err(14344): at com.android.org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:27)
01-02 15:18:07.537: W/System.err(14344): at android.os.Handler.dispatchMessage(Handler.java:102)
01-02 15:18:07.537: W/System.err(14344): at android.os.Looper.loop(Looper.java:136)
01-02 15:18:07.537: W/System.err(14344): at android.app.ActivityThread.main(ActivityThread.java:5017)
01-02 15:18:07.547: W/System.err(14344): at java.lang.reflect.Method.invokeNative(Native Method)
01-02 15:18:07.547: W/System.err(14344): at java.lang.reflect.Method.invoke(Method.java:515)
01-02 15:18:07.547: W/System.err(14344): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
01-02 15:18:07.547: W/System.err(14344): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
01-02 15:18:07.547: W/System.err(14344): at dalvik.system.NativeStart.main(Native Method)
01-02 15:18:07.577: W/chromium(14344): [WARNING:aw_contents_client_bridge.cc(83)] Ignoring unexpected ssl error proceed callback
我的发布代码如下
private void facebookFeedDialog() {
// Set the dialog parameters
Bundle params = new Bundle();
params.putString("name", "xxxxx");
params.putString("caption", xxxx);
params.putString("description", "check this room out");
params.putString("link", "http://xxxxxxx.com");
params.putString("picture", null);
// Invoke the dialog
WebDialog feedDialog = (new WebDialog.FeedDialogBuilder(RoomPage.this,
fSession, params)).setOnCompleteListener(
new OnCompleteListener() {
@Override
public void onComplete(Bundle values,
FacebookException error) {
// TODO Auto-generated method
// stub
if (error == null) {
// When the story is posted,
// echo the
// success
// and the post Id.
final String postId = values.getString("post_id");
if (postId != null) {
Toast.makeText(RoomPage.this,
"Story published: " + postId,
Toast.LENGTH_SHORT).show();
}
} else {
// Generic, ex: network error
error.printStackTrace();
Toast.makeText(
RoomPage.this,
"Error posting story", Toast.LENGTH_SHORT)
.show();
}
}
}).build();
feedDialog.show();
}