Android – how do I do it, user login or Facebook SDK 4.0.1

I'm using Facebook's new SDK 4.0.1 because when I change the login button to log out, the same button is used to log out without any code. But actually I want to do some coding when I log out. So how can I distinguish these two things in the SDK? How do I declare a logout method?

resolvent:

You can check when the token changes. If the new access token is empty, the user has just logged out

new AccessTokenTracker() {
    @Override
    protected void onCurrentAccessTokenChanged(AccessToken oldAccessToken, AccessToken newAccessToken) {
        if (newAccessToken==null)
            //your code here!
    }
};

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>