title: MediaScannerConnection produces android.app.ServiceConnectionLeaked
body: <p>I'm using the MediaScannerConnection example code from the <a href="http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/content/ExternalStorage.html" rel="nofollow noreferrer">API Demos</a></p>
  
  <p>The snippet I'm using is:</p>
  
  <pre><code>MediaScannerConnection.scanFile(
      context,
      new String[] { permFile.getAbsolutePath() }, 
      null,
      new MediaScannerConnection.OnScanCompletedListener() {
          public void onScanCompleted(String path, Uri uri) {
  
              android.util.Log.i("ExternalStorage", "Scanned " + path + ":");
              android.util.Log.i("ExternalStorage", "-&gt; uri=" + uri);
          }
  });
  </code></pre>
  
  <p>When I run this code, I get an FC dialog with the following from the <a href="https://sites.google.com/site/androidhowto/how-to-1/save-logcat-to-a-text-file" rel="nofollow noreferrer">LogCat</a>:</p>
  
  <pre><code>4-20 23:17:45.988: ERROR/ActivityThread(3015): Activity com.my.package.name has leaked ServiceConnection android.media.MediaScannerConnection@40715c70 that was originally bound here
  04-20 23:17:45.988: ERROR/ActivityThread(3015): android.app.ServiceConnectionLeaked: Activity com.my.package.name has leaked ServiceConnection android.media.MediaScannerConnection@40715c70 that was originally bound here
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>FYI, I'm running this from a background thread using AsyncTask.</p>