code: public void setBackgroundMode(boolean backgroundMode) {
          if (!isBleAvailableOrSimulated()) {
              LogManager.w(TAG, "Method invocation will be ignored.");
              return;
          }
          mBackgroundModeUninitialized = false;
          if (backgroundMode != mBackgroundMode) {
              mBackgroundMode = backgroundMode;
              try {
                  this.updateScanPeriods();
              } catch (RemoteException e) {
                  LogManager.e(TAG, "Cannot contact service to set scan periods");
              }
          }
      }
docs: This method notifies the beacon service that the application is either moving to background
  mode or foreground mode.  When in background mode, BluetoothLE scans to look for beacons are
  executed less frequently in order to save battery life. The specific scan rates for
  background and foreground operation are set by the defaults below, but may be customized.
  When ranging in the background, the time between updates will be much less frequent than in
  the foreground.  Updates will come every time interval equal to the sum total of the
  BackgroundScanPeriod and the BackgroundBetweenScanPeriod.
  
  @param backgroundMode true indicates the app is in the background
  @see #DEFAULT_FOREGROUND_SCAN_PERIOD
  @see #DEFAULT_FOREGROUND_BETWEEN_SCAN_PERIOD;
  @see #DEFAULT_BACKGROUND_SCAN_PERIOD;
  @see #DEFAULT_BACKGROUND_BETWEEN_SCAN_PERIOD;
  @see #setForegroundScanPeriod(long p)
  @see #setForegroundBetweenScanPeriod(long p)
  @see #setBackgroundScanPeriod(long p)
  @see #setBackgroundBetweenScanPeriod(long p)