Skip to content Skip to sidebar Skip to footer

How Can I Find My Current Login Status - Facebook Api Android

I am using Facebook Login Button to integrate Facebook Login to my app. When i press Facebook Login Button , it authenticates my Credentials and if successfully done , then change

Solution 1:

You can get the session using Session.getActiveSession() and then listen for session change event

Sessionsession= Session.getActiveSession();
if (session != null && (session.isOpened() || session.isClosed()) ) {
    onSessionStateChange(session, session.getState(), null);
}

And then check the session status:

privatevoid onSessionStateChange(Session session, SessionState state, Exceptionexception) {
   if (state.isOpened()) {
       Log.i("Logged", "Logged in...");
   }elseif (state.isClosed()) {
       Log.i("Logged", "Logged out...");
   }
}

Post a Comment for "How Can I Find My Current Login Status - Facebook Api Android"