public void onPause() {
        // remove the broadcast receiver
        broadcastManager.unregisterReceiver(receiver);

        if (callback != null) {
            Session session = Session.getActiveSession();
            if (session != null) {
                session.removeCallback(callback);
            }
        }
    }
public void onPause ( ) { broadcastManager . unregisterReceiver ( receiver ) ; if ( callback != null ) { Session session = Session . getActiveSession ( ) ; if ( session != null ) { session . removeCallback ( callback ) ; } } }
To be called from an Activity or Fragment's onPause method.