Categories
android facebook logout sdk session

Android Facebook SDK: Check if the user is logged in or not

I’m have a feature on my Android app where the user authorizes the app and shares a link.

I also need to give an option for the user to logout of facebook and I need to conditionally disable this button if the user is not logged int (or not authorized the app).

I can’t seem to find the API call on the Android SDK that would let me ask FB if the user is logged in or not.

What I have found is getAccessExpires():

Retrieve the current session’s expiration time (in milliseconds since
Unix epoch), or 0 if the session doesn’t expire or doesn’t exist.

Will checking if the session equals 0 be the way to go? Or is there something I’m missing?