code: public void connect() {
          if (!mMiddleware.isConnected()) {
              mMiddleware.connect();
          }
  
          if (!mNotificationManager.isRunning()) {
              mNotificationManager.start();
          }
  
          if (mAdvertiseManager.isAdvertisingEnabled()) {
              mMiddleware.registerAdvertisement(mAdvertiseManager.generateAdvProfile().toJSON(), 10000);
          }
      }
docs: Life-cycle methods