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