UiLifecycleHelper
最新版的 SDK 已不支持此类。
这个类有新版本。查看 最新版本。

This class helps to create, automatically open (if applicable), save, and restore the Active Session in a way that is similar to Android UI lifecycles.

When using this class, clients MUST call all the public methods from the respective methods in either an Activity or Fragment. Failure to call all the methods can result in improperly initialized or uninitialized Sessions.

This class should also be used by Activities that will be displaying native dialogs provided by the Facebook application, in order to handle processing of the activity results generated by those dialogs.

扩展:Object
应用安装包:facebook
构造函数
UiLifecycleHelper(Activity, StatusCallback)

Creates a new UiLifecycleHelper.

public UiLifecycleHelper(Activity activity, StatusCallback callback)
参数描述
activityThe Activity associated with the helper. If calling from a Fragment, use Fragment.getActivity()
callbackThe callback for Session status changes, can be null
实例方法
onCreate(Bundle)

To be called from an Activity or Fragment's onCreate method.

public void onCreate(Bundle savedInstanceState)
参数描述
savedInstanceStateThe previously saved state
onResume()

To be called from an Activity or Fragment's onResume method.

public void onResume()
onActivityResult(int, int, Intent)

To be called from an Activity or Fragment's onActivityResult method.

public void onActivityResult(int requestCode, int resultCode, Intent data)
参数描述
requestCodeThe request code
resultCodeThe result code
dataThe result data
onActivityResult(int, int, Intent, Callback)

To be called from an Activity or Fragment's onActivityResult method, when the results of a FacebookDialog call are expected.

public void onActivityResult(int requestCode, int resultCode, Intent data, Callback facebookDialogCallback)
参数描述
requestCodeThe request code
resultCodeThe result code
dataThe result data
facebookDialogCallback
onSaveInstanceState(Bundle)

To be called from an Activity or Fragment's onSaveInstanceState method.

public void onSaveInstanceState(Bundle outState)
参数描述
outStateThe bundle to save state in
onPause()

To be called from an Activity or Fragment's onPause method.

public void onPause()
onStop()

To be called from an Activity or Fragment's onStop method.

public void onStop()
onDestroy()

To be called from an Activity or Fragment's onDestroy method.

public void onDestroy()
trackPendingDialogCall(PendingCall)

Register that we are expecting results from a call to the Facebook application (e.g., from a native dialog provided by the Facebook app). Activity results forwarded to onActivityResults will be parsed and handled if they correspond to this call. Only a single pending FacebookDialog call can be tracked at a time; attempting to track another one will cancel the first one.

public void trackPendingDialogCall(PendingCall pendingCall)
参数描述
pendingCall
getAppEventsLogger()

Retrieves an instance of AppEventsLogger that can be used for the current Session, if any. Different instances may be returned if the current Session changes, so this value should not be cached for long periods of time -- always call getAppEventsLogger to get the right logger for the current Session. If no Session is currently available, this method will return null.

To ensure delivery of app events across Activity lifecycle events, calling Activities should be sure to call the onStop method.

public AppEventsLogger getAppEventsLogger()
Returns
An AppEventsLogger to use for logging app events