facebook android sdk 4.0 , way to unregister callback from LoginManager

时间:2015-05-08 10:07:28

标签: android facebook-android-sdk facebook-sdk-4.0

I am using the facebook sdk 4.0 inmy android app. I have an Activity whose functionality is to post some message to facebook ( this is not my main Activity of my app ) i am doing the following to login to facebook and then post the message

refresh()

questions is, How do i unregister this callback from LoginManager ? i didnt find any method in LoginManager to do so.

Any reason why the sdk is designed in such way that it doesnt provide option to unregister ?

Problem is, if my activity gets destroyed and recreated ( say, due to device rotation) , the LoginManager would always have a reference to my previous activity instance which is not right.

i would like to unregister in the onDestory of the activity.

Thanks,

1 个答案:

答案 0 :(得分:3)

LoginManager不会保留对回调的引用,回调管理器会这样做。只要您将回调管理器1-1保留在活动中,您的回调就会被垃圾回收。