public void setBackgroundInterval(long interval, TimeUnit unit)
  {
    if (! isValid()) {
      return;
    }
    
    long period = unit.toMillis(interval);
    
    if (_state == StateProfile.IDLE) {
      if (period > 0) {
        _profileTask.setPeriod(period);
        _profileTask.start();
        
        _state = StateProfile.BACKGROUND;
      }
    }
    else if (_state == StateProfile.BACKGROUND) {
      if (period <= 0) {
        _profileTask.stop();
        
        _state = StateProfile.IDLE;
      }
      else if (period != _backgroundPeriod) {
        _profileTask.stop();
        _profileTask.setPeriod(period);
        _profileTask.start();
      }
    }
    
    _backgroundPeriod = period;
  }
public void setBackgroundInterval ( long interval , TimeUnit unit ) { if ( ! isValid ( ) ) { return ; } long period = unit . toMillis ( interval ) ; if ( _state == StateProfile . IDLE ) { if ( period > 0 ) { _profileTask . setPeriod ( period ) ; _profileTask . start ( ) ; _state = StateProfile . BACKGROUND ; } } else if ( _state == StateProfile . BACKGROUND ) { if ( period <= 0 ) { _profileTask . stop ( ) ; _state = StateProfile . IDLE ; } else if ( period != _backgroundPeriod ) { _profileTask . stop ( ) ; _profileTask . setPeriod ( period ) ; _profileTask . start ( ) ; } } _backgroundPeriod = period ; }
Sets the time interval for the background profile.