Facebook的管理会议在Android应用程序贯穿多种活动与Facebook SDK 3应用程序、多种、会议、Facebook

2023-09-04 12:33:43 作者:安洛殇

我已经开始使用Facebook的SDK 3.0。我使用LoginButton插件登录到Facebook的。我指的美味样品这样做。在此示例中,一个活动(凡会话初始化)承载多个片段。

I have started using Facebook SDK 3.0. I am using LoginButton widget to login into the Facebook. I am referring Scrumptious sample for doing so. In this sample, one Activity(Where session is being initialized) is hosting multiple Fragments.

但是,在我的应用程序,多活动主办多个片段。 首先发射活动(凡会话初始化)完成了登录操作与LoginButton部件。我该如何处理会话当我移动到其他活动???

But in my app, multiple activities hosting multiple fragments. First the launcher activity(Where session is being initialized) does the login operation with the LoginButton widget. How can i handle the session when I moved to other activities???

我发现同类型的计算器中的问题,但一直无人接听的德precated Facebook的对象的。但我需要相对于LoginButton部件回答,UiLifecycleHelper和Session.StatusCallback

I found same kind of questions in StackOverFlow, but it has been answered for deprecated Facebook object. But i need answer with respect to LoginButton widget, UiLifecycleHelper and Session.StatusCallback.

在此先感谢

推荐答案

您必须始终参考,以独特的会话类。 每个活动都有拿一个已经打开的会话从会话类,或者,如果没有有效的会话中,创建一个新的。该方法做,这是的 Session.getActiveSession()的。照片 然后,在每一个活动中,添加定义相关的会话状态变化逻辑回调。

You must always refer to the unique Session class. Every activity has to take an already opened session from the Session class or, if no valid sessions are found, created a new one. The method for doing this is Session.getActiveSession(). Then, in each activity, you add the callback that define the logic related to a session state change.

的UiLifecycleHelper是一个非常有用的类,它可以帮助你(具有去除在它就是所谓的活动增加了回调的例子此类交易中的onPause()方法)

The UiLifecycleHelper is a very useful class that can help you manage the session state among the activities lifecycle (for example the onPause() method of this class deal with the removal of the callback added in the activity in which it's called)

 
精彩推荐