Java Code Examples for com.facebook.Session#removeCallback()

The following examples show how to use com.facebook.Session#removeCallback() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SessionTracker.java    From aws-mobile-self-paced-labs-samples with Apache License 2.0 5 votes vote down vote up
/**
 * Set the Session object to track.
 * 
 * @param newSession the new Session object to track
 */
public void setSession(Session newSession) {
    if (newSession == null) {
        if (session != null) {
            // We're current tracking a Session. Remove the callback
            // and start tracking the active Session.
            session.removeCallback(callback);
            session = null;
            addBroadcastReceiver();
            if (getSession() != null) {
                getSession().addCallback(callback);
            }
        }
    } else {
        if (session == null) {
            // We're currently tracking the active Session, but will be
            // switching to tracking a different Session object.
            Session activeSession = Session.getActiveSession();
            if (activeSession != null) {
                activeSession.removeCallback(callback);
            }
            broadcastManager.unregisterReceiver(receiver);
        } else {
            // We're currently tracking a Session, but are now switching 
            // to a new Session, so we remove the callback from the old 
            // Session, and add it to the new one.
            session.removeCallback(callback);
        }
        session = newSession;
        session.addCallback(callback);
    }
}
 
Example 2
Source File: SessionTracker.java    From HypFacebook with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Stop tracking the Session and remove any callbacks attached
 * to those sessions.
 */
public void stopTracking() {
    if (!isTracking) {
        return;
    }
    Session session = getSession();
    if (session != null) {
        session.removeCallback(callback);
    }
    broadcastManager.unregisterReceiver(receiver);
    isTracking = false;
}
 
Example 3
Source File: SessionTracker.java    From HypFacebook with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Set the Session object to track.
 * 
 * @param newSession the new Session object to track
 */
public void setSession(Session newSession) {
    if (newSession == null) {
        if (session != null) {
            // We're current tracking a Session. Remove the callback
            // and start tracking the active Session.
            session.removeCallback(callback);
            session = null;
            addBroadcastReceiver();
            if (getSession() != null) {
                getSession().addCallback(callback);
            }
        }
    } else {
        if (session == null) {
            // We're currently tracking the active Session, but will be
            // switching to tracking a different Session object.
            Session activeSession = Session.getActiveSession();
            if (activeSession != null) {
                activeSession.removeCallback(callback);
            }
            broadcastManager.unregisterReceiver(receiver);
        } else {
            // We're currently tracking a Session, but are now switching 
            // to a new Session, so we remove the callback from the old 
            // Session, and add it to the new one.
            session.removeCallback(callback);
        }
        session = newSession;
        session.addCallback(callback);
    }
}
 
Example 4
Source File: SessionTracker.java    From facebook-api-android-maven with Apache License 2.0 5 votes vote down vote up
/**
 * Stop tracking the Session and remove any callbacks attached
 * to those sessions.
 */
public void stopTracking() {
    if (!isTracking) {
        return;
    }
    Session session = getSession();
    if (session != null) {
        session.removeCallback(callback);
    }
    broadcastManager.unregisterReceiver(receiver);
    isTracking = false;
}
 
Example 5
Source File: SessionTracker.java    From facebook-api-android-maven with Apache License 2.0 5 votes vote down vote up
/**
 * Set the Session object to track.
 * 
 * @param newSession the new Session object to track
 */
public void setSession(Session newSession) {
    if (newSession == null) {
        if (session != null) {
            // We're current tracking a Session. Remove the callback
            // and start tracking the active Session.
            session.removeCallback(callback);
            session = null;
            addBroadcastReceiver();
            if (getSession() != null) {
                getSession().addCallback(callback);
            }
        }
    } else {
        if (session == null) {
            // We're currently tracking the active Session, but will be
            // switching to tracking a different Session object.
            Session activeSession = Session.getActiveSession();
            if (activeSession != null) {
                activeSession.removeCallback(callback);
            }
            broadcastManager.unregisterReceiver(receiver);
        } else {
            // We're currently tracking a Session, but are now switching 
            // to a new Session, so we remove the callback from the old 
            // Session, and add it to the new one.
            session.removeCallback(callback);
        }
        session = newSession;
        session.addCallback(callback);
    }
}
 
Example 6
Source File: SessionTracker.java    From FacebookNewsfeedSample-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Set the Session object to track.
 * 
 * @param newSession the new Session object to track
 */
public void setSession(Session newSession) {
    if (newSession == null) {
        if (session != null) {
            // We're current tracking a Session. Remove the callback
            // and start tracking the active Session.
            session.removeCallback(callback);
            session = null;
            addBroadcastReceiver();
            if (getSession() != null) {
                getSession().addCallback(callback);
            }
        }
    } else {
        if (session == null) {
            // We're currently tracking the active Session, but will be
            // switching to tracking a different Session object.
            Session activeSession = Session.getActiveSession();
            if (activeSession != null) {
                activeSession.removeCallback(callback);
            }
            broadcastManager.unregisterReceiver(receiver);
        } else {
            // We're currently tracking a Session, but are now switching 
            // to a new Session, so we remove the callback from the old 
            // Session, and add it to the new one.
            session.removeCallback(callback);
        }
        session = newSession;
        session.addCallback(callback);
    }
}
 
Example 7
Source File: SessionTracker.java    From KlyphMessenger with MIT License 5 votes vote down vote up
/**
 * Set the Session object to track.
 * 
 * @param newSession the new Session object to track
 */
public void setSession(Session newSession) {
    if (newSession == null) {
        if (session != null) {
            // We're current tracking a Session. Remove the callback
            // and start tracking the active Session.
            session.removeCallback(callback);
            session = null;
            addBroadcastReceiver();
            if (getSession() != null) {
                getSession().addCallback(callback);
            }
        }
    } else {
        if (session == null) {
            // We're currently tracking the active Session, but will be
            // switching to tracking a different Session object.
            Session activeSession = Session.getActiveSession();
            if (activeSession != null) {
                activeSession.removeCallback(callback);
            }
            broadcastManager.unregisterReceiver(receiver);
        } else {
            // We're currently tracking a Session, but are now switching 
            // to a new Session, so we remove the callback from the old 
            // Session, and add it to the new one.
            session.removeCallback(callback);
        }
        session = newSession;
        session.addCallback(callback);
    }
}
 
Example 8
Source File: SessionTracker.java    From Abelana-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Stop tracking the Session and remove any callbacks attached
 * to those sessions.
 */
public void stopTracking() {
    if (!isTracking) {
        return;
    }
    Session session = getSession();
    if (session != null) {
        session.removeCallback(callback);
    }
    broadcastManager.unregisterReceiver(receiver);
    isTracking = false;
}
 
Example 9
Source File: SessionTracker.java    From Abelana-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Set the Session object to track.
 * 
 * @param newSession the new Session object to track
 */
public void setSession(Session newSession) {
    if (newSession == null) {
        if (session != null) {
            // We're current tracking a Session. Remove the callback
            // and start tracking the active Session.
            session.removeCallback(callback);
            session = null;
            addBroadcastReceiver();
            if (getSession() != null) {
                getSession().addCallback(callback);
            }
        }
    } else {
        if (session == null) {
            // We're currently tracking the active Session, but will be
            // switching to tracking a different Session object.
            Session activeSession = Session.getActiveSession();
            if (activeSession != null) {
                activeSession.removeCallback(callback);
            }
            broadcastManager.unregisterReceiver(receiver);
        } else {
            // We're currently tracking a Session, but are now switching 
            // to a new Session, so we remove the callback from the old 
            // Session, and add it to the new one.
            session.removeCallback(callback);
        }
        session = newSession;
        session.addCallback(callback);
    }
}
 
Example 10
Source File: SessionTracker.java    From aws-mobile-self-paced-labs-samples with Apache License 2.0 5 votes vote down vote up
/**
 * Stop tracking the Session and remove any callbacks attached
 * to those sessions.
 */
public void stopTracking() {
    if (!isTracking) {
        return;
    }
    Session session = getSession();
    if (session != null) {
        session.removeCallback(callback);
    }
    broadcastManager.unregisterReceiver(receiver);
    isTracking = false;
}
 
Example 11
Source File: SessionTracker.java    From platform-friends-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Set the Session object to track.
 * 
 * @param newSession the new Session object to track
 */
public void setSession(Session newSession) {
    if (newSession == null) {
        if (session != null) {
            // We're current tracking a Session. Remove the callback
            // and start tracking the active Session.
            session.removeCallback(callback);
            session = null;
            addBroadcastReceiver();
            if (getSession() != null) {
                getSession().addCallback(callback);
            }
        }
    } else {
        if (session == null) {
            // We're currently tracking the active Session, but will be
            // switching to tracking a different Session object.
            Session activeSession = Session.getActiveSession();
            if (activeSession != null) {
                activeSession.removeCallback(callback);
            }
            broadcastManager.unregisterReceiver(receiver);
        } else {
            // We're currently tracking a Session, but are now switching 
            // to a new Session, so we remove the callback from the old 
            // Session, and add it to the new one.
            session.removeCallback(callback);
        }
        session = newSession;
        session.addCallback(callback);
    }
}
 
Example 12
Source File: SessionTracker.java    From FacebookImageShareIntent with MIT License 5 votes vote down vote up
/**
 * Stop tracking the Session and remove any callbacks attached
 * to those sessions.
 */
public void stopTracking() {
    if (!isTracking) {
        return;
    }
    Session session = getSession();
    if (session != null) {
        session.removeCallback(callback);
    }
    broadcastManager.unregisterReceiver(receiver);
    isTracking = false;
}
 
Example 13
Source File: SessionTracker.java    From FacebookImageShareIntent with MIT License 5 votes vote down vote up
/**
 * Set the Session object to track.
 * 
 * @param newSession the new Session object to track
 */
public void setSession(Session newSession) {
    if (newSession == null) {
        if (session != null) {
            // We're current tracking a Session. Remove the callback
            // and start tracking the active Session.
            session.removeCallback(callback);
            session = null;
            addBroadcastReceiver();
            if (getSession() != null) {
                getSession().addCallback(callback);
            }
        }
    } else {
        if (session == null) {
            // We're currently tracking the active Session, but will be
            // switching to tracking a different Session object.
            Session activeSession = Session.getActiveSession();
            if (activeSession != null) {
                activeSession.removeCallback(callback);
            }
            broadcastManager.unregisterReceiver(receiver);
        } else {
            // We're currently tracking a Session, but are now switching 
            // to a new Session, so we remove the callback from the old 
            // Session, and add it to the new one.
            session.removeCallback(callback);
        }
        session = newSession;
        session.addCallback(callback);
    }
}
 
Example 14
Source File: SessionTracker.java    From android-skeleton-project with MIT License 5 votes vote down vote up
/**
 * Stop tracking the Session and remove any callbacks attached
 * to those sessions.
 */
public void stopTracking() {
    if (!isTracking) {
        return;
    }
    Session session = getSession();
    if (session != null) {
        session.removeCallback(callback);
    }
    broadcastManager.unregisterReceiver(receiver);
    isTracking = false;
}
 
Example 15
Source File: SessionTracker.java    From android-skeleton-project with MIT License 5 votes vote down vote up
/**
 * Set the Session object to track.
 * 
 * @param newSession the new Session object to track
 */
public void setSession(Session newSession) {
    if (newSession == null) {
        if (session != null) {
            // We're current tracking a Session. Remove the callback
            // and start tracking the active Session.
            session.removeCallback(callback);
            session = null;
            addBroadcastReceiver();
            if (getSession() != null) {
                getSession().addCallback(callback);
            }
        }
    } else {
        if (session == null) {
            // We're currently tracking the active Session, but will be
            // switching to tracking a different Session object.
            Session activeSession = Session.getActiveSession();
            if (activeSession != null) {
                activeSession.removeCallback(callback);
            }
            broadcastManager.unregisterReceiver(receiver);
        } else {
            // We're currently tracking a Session, but are now switching 
            // to a new Session, so we remove the callback from the old 
            // Session, and add it to the new one.
            session.removeCallback(callback);
        }
        session = newSession;
        session.addCallback(callback);
    }
}
 
Example 16
Source File: SessionTracker.java    From barterli_android with Apache License 2.0 5 votes vote down vote up
/**
 * Stop tracking the Session and remove any callbacks attached
 * to those sessions.
 */
public void stopTracking() {
    if (!isTracking) {
        return;
    }
    Session session = getSession();
    if (session != null) {
        session.removeCallback(callback);
    }
    broadcastManager.unregisterReceiver(receiver);
    isTracking = false;
}
 
Example 17
Source File: SessionTracker.java    From FacebookNewsfeedSample-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Stop tracking the Session and remove any callbacks attached
 * to those sessions.
 */
public void stopTracking() {
    if (!isTracking) {
        return;
    }
    Session session = getSession();
    if (session != null) {
        session.removeCallback(callback);
    }
    broadcastManager.unregisterReceiver(receiver);
    isTracking = false;
}
 
Example 18
Source File: SessionTracker.java    From Klyph with MIT License 5 votes vote down vote up
/**
 * Stop tracking the Session and remove any callbacks attached
 * to those sessions.
 */
public void stopTracking() {
    if (!isTracking) {
        return;
    }
    Session session = getSession();
    if (session != null) {
        session.removeCallback(callback);
    }
    broadcastManager.unregisterReceiver(receiver);
    isTracking = false;
}
 
Example 19
Source File: SessionTracker.java    From Klyph with MIT License 5 votes vote down vote up
/**
 * Set the Session object to track.
 * 
 * @param newSession the new Session object to track
 */
public void setSession(Session newSession) {
    if (newSession == null) {
        if (session != null) {
            // We're current tracking a Session. Remove the callback
            // and start tracking the active Session.
            session.removeCallback(callback);
            session = null;
            addBroadcastReceiver();
            if (getSession() != null) {
                getSession().addCallback(callback);
            }
        }
    } else {
        if (session == null) {
            // We're currently tracking the active Session, but will be
            // switching to tracking a different Session object.
            Session activeSession = Session.getActiveSession();
            if (activeSession != null) {
                activeSession.removeCallback(callback);
            }
            broadcastManager.unregisterReceiver(receiver);
        } else {
            // We're currently tracking a Session, but are now switching 
            // to a new Session, so we remove the callback from the old 
            // Session, and add it to the new one.
            session.removeCallback(callback);
        }
        session = newSession;
        session.addCallback(callback);
    }
}
 
Example 20
Source File: SessionTracker.java    From platform-friends-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Stop tracking the Session and remove any callbacks attached
 * to those sessions.
 */
public void stopTracking() {
    if (!isTracking) {
        return;
    }
    Session session = getSession();
    if (session != null) {
        session.removeCallback(callback);
    }
    broadcastManager.unregisterReceiver(receiver);
    isTracking = false;
}