title: IntentService fails to run in certain situations
body: <p>I got a problem. Every once in a while, the IntentService <code>UpdateService02</code> fails to run. I put log entries in so I could debug and here's what I get...</p>
  <blockquote>
  <p>02-28 21:37:32.461: Main - Broadcast Sent</p>
  <p>02-28 21:37:32.484: BroadcastReceiver - Main Started; Set Alarm</p>
  <p>02-28 21:37:32.539: BroadcastReceiver - Received AlarmService</p>
  <p>02-28 21:38:32.500: BroadcastReceiver - Received AlarmService</p>
  </blockquote>
  <p>Usually this should happen:</p>
  <blockquote>
  <p>02-28 21:37:32.461: Main - Broadcast Sent</p>
  <p>02-28 21:37:32.484: BroadcastReceiver - Main Started; Set Alarm</p>
  <p>02-28 21:37:32.539: BroadcastReceiver - Received AlarmService</p>
  <p>02-28 21:38:32.500: UpdateService -- onHandleIntent()</p>
  </blockquote>
  <p>Any ideas? Here's my Broadcast Receiver code...</p>
  <p>Broadcast Receiver:</p>
  <pre><code>public class AlarmReceiver extends BroadcastReceiver {
  
      private static final int INTERVAL = 60*1000; // check every 60 seconds
  
      @Override
      public void onReceive(Context context, Intent intent) {
          if(intent.getAction() != null) {
              if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
                  Log.v(TAG, &quot;BroadcastReceiver - Received Boot Completed; Set Alarm&quot;);
              
                  setRecurringAlarm(context);
              }else if(intent.getAction().equalsIgnoreCase(Main.BROADCAST_STARTUP)){
                  Log.v(TAG, &quot;BroadcastReceiver - Main Started; Set Alarm&quot;);
              
                  setRecurringAlarm(context);
              }else{
                  Log.v(TAG, &quot;BroadcastReceiver - Received &quot; + intent.getAction());
              }
          }else{
              Log.v(TAG, &quot;BroadcastReceiver - Received AlarmService&quot;);
          
              Intent i = new Intent(context, UpdateService02.class);
              context.startService(i);
          }
      }
  
      private void setRecurringAlarm(Context context) {
          Intent receiver = new Intent(context, AlarmReceiver.class);
          PendingIntent recurringDownload = PendingIntent.getBroadcast(context, 0, receiver, PendingIntent.FLAG_CANCEL_CURRENT);
          AlarmManager alarms = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
          alarms.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), INTERVAL, recurringDownload);
      }
  }
  </code></pre>
  <p>Intent Service:</p>
  <pre><code>public class UpdateService02 extends IntentService {
  
      static DefaultHttpClient mClient = Client.getClient();
      private static final int LIST_UPDATE_NOTIFICATION = 100;
  
      public UpdateService02() {
          super(&quot;UpdateService02&quot;);
      }
  
      @Override
      protected void onHandleIntent(Intent intent) {
          Log.v(TAG, &quot;UpdateService -- onHandleIntent()&quot;);
      
          try {
              HttpGet httpget = new HttpGet(url);
              HttpResponse response;
              response = mClient.execute(httpget);
              BufferedReader in = new BufferedReader (new InputStreamReader(response.getEntity().getContent()));
          
              Intent i = new Intent(BROADCAST_UPDATE);  
              i.putExtra(&quot;text&quot;, in.readLine().toString() + &quot; updated&quot;);
              sendBroadcast(i);
          } catch (ClientProtocolException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  <p>I thought it might be I need to set the intentservice startup's context to be the applications, but I honestly have no idea.</p>