In previous versions of the Facebook SDK we could check if a user is still signed in by using tokens. In the new 3.0 version I can't find another way other than invoking openSession()
to check if the user is still logged in with SSO
. But openSession()
automatically invokes the login if the user is not saved and I don't want that. I only want to check SSO. How do I do this?
I made a helper function that to check if the user is still logged in (or actually has an active session) for me in my app:
public static boolean isActive() {
Session session = Session.getActiveSession();
if (session == null) {
return false;
}
return session.isOpened();
}
Alternatively, you can call Session.openActiveSession(Context context), which according to the javadocs, will only open the session if it does not require user interaction. – Ming Li
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.