问题描述
我申请我的应用程序Facebook的份额当然也包括登录,但问题是,当我分享内容到Facebook上的onActivityResult没有给予任何回报。这里继Facebook共享指南我实现了两个一切,共享成功地和withouth的Facebook应用程序安装。唯一的区别是,我可以得到的WebView但不是故意的结果。这里是我的code上的活动,结果是:
I applied a facebook share on my app which of course includes a login but the problem is that when I shared a content to facebook the onActivityResult doesn't give any return. Following the facebook share guide here I implemented everything and shares successfully on both with and withouth facebook app installed. the only difference is that I can get the result on webview but not on intent. Here's my code on the activity result:
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Log.e("Activity","You wa shock!");
uiHelper.onActivityResult(requestCode, resultCode, data, new FacebookDialog.Callback() {
@Override
public void onError(FacebookDialog.PendingCall pendingCall, Exception error, Bundle data) {
Log.e("Activity", String.format("Error: %s", error.toString()));
}
@Override
public void onComplete(FacebookDialog.PendingCall pendingCall, Bundle data) {
boolean didCancel = FacebookDialog.getNativeDialogDidComplete(data);
String completionGesture = FacebookDialog.getNativeDialogCompletionGesture(data);
String postId = FacebookDialog.getNativeDialogPostId(data);
if (didCancel)
{
if (completionGesture == null || FacebookDialog.COMPLETION_GESTURE_CANCEL.equals(completionGesture)){
Toast.makeText(getActivity(),"CANCELLED",Toast.LENGTH_SHORT).show();
}
else{
// track post
Toast.makeText(getActivity(),"POSTED",Toast.LENGTH_SHORT).show();
}
}
else
{
Toast.makeText(getActivity(),"CANCELLED",Toast.LENGTH_SHORT).show();
}
}
});
}
在code的另一部分只是一个副本粘贴究竟什么教程有,但对于这部分,即使第一个日志,我把不出来,即使我已经OAuth'd我的应用程序,并成功登录
The other part of the code is just a copy paste exactly on what the tutorial have but for this part even the first log I placed doesn't show up even though I already OAuth'd my app and login successfully.
推荐答案
您需要做的
shareFacebookDialog.setFragment(this);
在哪里这是片断的结果
得到回调在片段
where "this" is the fragment
to get the callback in the fragment
这篇关于对股票点击Facebook的意向份额犯规秀活动结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!