private void setAutoDetectConnectivityStateInternal(boolean shouldAutoDetect) {
   if (shouldAutoDetect) {
     if (mAutoDetector == null) {
       mAutoDetector =
           new NetworkChangeNotifierAutoDetect(
               new NetworkChangeNotifierAutoDetect.Observer() {
                 @Override
                 public void onConnectionTypeChanged(int newConnectionType) {
                   updateCurrentConnectionType(newConnectionType);
                 }
               },
               mContext);
       updateCurrentConnectionType(mAutoDetector.getCurrentConnectionType());
     }
   } else {
     destroyAutoDetector();
   }
 }
 private void destroyAutoDetector() {
   if (mAutoDetector != null) {
     mAutoDetector.destroy();
     mAutoDetector = null;
   }
 }