Facebook callbackManager方法onActivityResult未在片段onActivityResult方法中调用 [英] Facebook callbackManager method onActivityResult not calling in Fragment onActivityResult method

查看:134
本文介绍了Facebook callbackManager方法onActivityResult未在片段onActivityResult方法中调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经实现了Facebook集成,即使Facebook APPID也适合应用程序,它在初始化的一部分中也能正常工作.

I have implemented Facebook integration and it's working fine in part of initialization even Facebook APPID is also fine with application.

所以让我更详细地解释一下: 我已经在onCreate()中添加并初始化了Facebook.

So let me explain in more detail : I have added and initialize Facebook in onCreate().

// Facebook callback manager
callbackManager = CallbackManager.Factory.create();

还可以在片段活动"中覆盖片段中的方法.

Also override a method in fragment as well in Fragment Activity.

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    callbackManager.onActivityResult(requestCode, resultCode, data);
}

此方法在ActivityFragment类中都是相同的.

This method is same in both Activity and Fragment class.

但是问题是当我请求Facebook AppInviteContent 显示一个 AppInviteDialog 时,它在Activity中被完美地称为onActivityResult方法,而在Fragment方法中却没有被调用.

But the issue is when i request of facebook AppInviteContent to show a AppInviteDialog than it is perfectly called onActivityResult method in Activity but not getting called in Fragment method.

如果有什么见识的人,可以给我任何建议.欢迎任何意见或建议.

If anyone have insight than give me any suggestion. Any comment or suggestion are welcome.

推荐答案

根据facebook 文档,在一个片段中,您应该调用此方法

According to facebook documentations, In a fragment, you should call this method

> Java 

loginButton.setFragment(this);

> Kotlin

loginButton.fragment = this

这篇关于Facebook callbackManager方法onActivityResult未在片段onActivityResult方法中调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆