Creating a class for Facebook SDK 3.0 on Android

后端 未结 2 1683
我在风中等你
我在风中等你 2020-12-22 11:03

Is it possible to create a class to encapsulate the Android SDK on android?

i.e - I don\'t want to clutter my activity with all the FB sessions and stuff, I want to

2条回答
  •  醉梦人生
    2020-12-22 11:34

    In short, no.

    Your activity needs to be notifying the Facebook SDK of lifecycle events in order to properly store state and handle the UI flow to and from the Facebook SDK activities.

    UILifecycleHelper is an effort to encapsulate this as much as possible.

    You may be able to unclutter your code by having all your activities extend some base class (i.e. FBActivity) that makes all the proper calls to UILifecycleHelper, though this only helps if all your activities are interacting with Facebook in a fairly uniform manner.

提交回复
热议问题