title: Variables in my Service/IntentService are reset on every start
body: <p>I declared a service, that shall act as a queue. Therefore I have a variable that tells the service it's the first start and another one that stores a value.</p>
  
  <p>The code looks like this:</p>
  
  <pre><code>public class TTSQueue extends Service {
  
  private Integer lastvol = 0;
  private Boolean isFirstStart = true;
  
  @Override
  public int onStartCommand(Intent intent, int flags, int startId) {
      Bundle b = intent.getExtras();
      Integer vol = b.getInt(TTS.PARAM_LAST_VOL, 0);
      if (vol &gt; lastvol) {
          lastvol = vol;
      }
      if (isFirstStart) {
          isFirstStart = false;
          startAnotherService();
      } else {
          waitForAnEventAndThen_startAnotherService();
      }
  
  }
  </code></pre>
  
  <p>Okay, the problem is, this Service is started from a receiver. And everytime it is started, both <code>lastvol</code> and <code>isFirstStart</code> are reset. I thought, if the Service is already created and then started with an Intent, it would only call <code>onStartCommand()</code> again and not reset everything.</p>
  
  <p>I also tried only declaring the variables and setting them to the default value in <code>onCreate()</code>, but that had the same effect.
  Also I tried replacing the <code>Service</code> with an <code>IntentService</code>, but that doesn't help either, same problem.</p>
  
  <p>I would like to avoid using <code>SharedPreferences</code>, as I don't think it is necessarily needed in this case. (And I don't want to waste the user's Write Cycles).</p>
  
  <p>Am I missing something? I guess it is not because of the <code>private</code> declaration, is it?</p>