Managing Facebook Session in Android App throughout multiple activities with Facebook SDK 3

前端 未结 1 778
梦如初夏
梦如初夏 2021-01-14 10:45

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

相关标签:
1条回答
  • 2021-01-14 10:55

    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.

    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)

    0 讨论(0)
提交回复
热议问题