title: PendingIntents and Google Play Services - how to do cleanup
body: <p>I've been playing around with <a href="http://developer.android.com/training/location/activity-recognition.html#side-nav" rel="nofollow">User's activity recognition</a> and the <a href="http://developer.android.com/training/location/receive-location-updates.html" rel="nofollow">Fused location provider</a> and noticed that even after I uninstalled the sample app, activity recognition requests / location requests are still being fired as I'm seeing the following every couple of seconds : </p>
  
  <pre><code>05-20 23:20:22.569: W/ActivityManager(389): Unable to start service Intent { cmp=com.example.android.activityrecognition/.ActivityRecognitionIntentService (has extras) } U=0: not found
  </code></pre>
  
  <p>The exception obviously coming from the fact that my service is gone (app uninstalled).</p>
  
  <p>I'm seeing the same thing with the location provider. </p>
  
  <p>As a consequence, if a pending intent was used like this </p>
  
  <pre><code>Intent intent = new Intent(Constants.INTENT_ACTION_LOCATION_UPDATED);
  PendingIntent pendingIntent = PendingIntent.getService(BasicMapActivity.this, LOCATION_INTENT_CODE, intent, 0);
  LocationRequest locationRequest = LocationRequest.create().setInterval(5000).setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
  locationClient.requestLocationUpdates(locationRequest, pendingIntent);
  </code></pre>
  
  <p>This could leave the GPS polling for a location all the time in the event the app is uninstalled or the app has crashed and no proper "user-cleanup" took place.</p>
  
  <p>Is this normal behavior ? I would imagine some cleanup on PendingIntents would be done when the app is removed . </p>
  
  <p>Is this related to the fact that these request are flowing through the Google Play Services process ? </p>
  
  <p>How should we deal with this ?</p>
  
  <p><strong>EDIT</strong> : Posted an issue in the <a href="https://code.google.com/p/android/issues/detail?can=2&amp;start=0&amp;num=100&amp;q=&amp;colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&amp;groupby=&amp;sort=&amp;id=55616" rel="nofollow">Android tracker</a> but was told this is not the correct place for reporting issues with Google Apps. Posted it on the <a href="http://productforums.google.com/forum/#!category-topic/mobile/other-google-products/IsBnnibS5sw" rel="nofollow">Google Mobile Help Forum</a></p>