title: Android IntentService - too quick to die?
body: <p>I've recently began experimenting with <code>Android</code> development by my own accord, but find myself lacking people to ask about such things as a I come to you with today.</p>
  
  <p>See, I've tasked myself with building a small application that counts the amount of times you've received a call within <code>x</code> hours.</p>
  
  <p>After a little bit of googling I found that an <code>IntentService</code> should be used for something like this (if this is incorrect and I should use a <code>Service</code> instead, give me a wink).</p>
  
  <p>I've implemented the n <code>IntentService</code>, and gotten it to run through the following code:</p>
  
  <pre><code>@Override
  protected void onStart() {
  
      Log.i(info, "The app started!");
  
      Intent i = new Intent(this, IntentServiceTest.class);
      i.putExtra("KEY1", "information!");
      this.startService(i);
  
      super.onStart();
  }
  </code></pre>
  
  <p>Which, if you didn't guess; happens when my application starts it's first <code>Activity</code> (I can post the entire <code>Activity</code> if desired).</p>
  
  <p>My <code>IntentService</code> looks like this:</p>
  
  <pre><code>public class IntentServiceTest extends IntentService {
  public IntentServiceTest() {
      super("IntentServiceTest");
  }
  
  @Override
  public void onCreate() {
      super.onCreate();
      Log.i(FirstActivity.info, "The IntetService started!");
  }
  
  @Override
  protected void onHandleIntent(Intent workIntent) {
      Log.i(FirstActivity.info, "Here is some " + workIntent.getExtras().get("KEY1").toString());
  }
  
  @Override
  public void onDestroy() {
      super.onDestroy();
      Log.i(FirstActivity.info, "The IntetService ended!");
  }
  }
  </code></pre>
  
  <p>Now thus far, I thought I was in on the green. But as some of you sharper minds may have guessed, my <code>IntentService</code> does, you know, end. As was revealed to me when my Logcat revealed:</p>
  
  <pre><code>I/[INFORMATION]: The IntetService ended!
  </code></pre>
  
  <p>It has not lasted <code>x</code> hours, and it certainly hasn't counted any inbound phone calls (though the latter is a problem for another day).</p>
  
  <p>How do I get this <code>IntentService</code> to lay dormant in the background, while listening for incoming phone calls?</p>
  
  <p>Every time I click the "Home" button in my emulator, my console tells me that:</p>
  
  <pre><code>E/Surface: getSlotFromBufferLocked: unknown buffer: 0xab7d30a0
  </code></pre>
  
  <p>(Which I'm just guessing is because the <code>IntentService</code> is dead?)</p>
  
  <p>Can anyone give me a quick explanation on how to keep my <code>IntentService</code> alive over time? Even after the user hits the "Home" button and thus leaves the app?</p>