Filter list of apps on SD card / internal
<p><strong>Update</strong> I must target Android 2.1.</p>

<p>I am trying to find out how to list apps programatically, filtered by being on the SD card or internal storage.</p>

<p>I'm not certain how to even approach this. Should I first detect the SD card mount point and see if an app data directory is on it? For example</p>

<pre><code>if (android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED)) {
  Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);     
  List&lt;ResolveInfo&gt; intents = m_pm.queryIntentActivities(mainIntent, 0);
  File baseSD = Environment.getExternalStorageDirectory();

  int count = intents.size();
  for (int i = 0; i &lt; count; i++) {
    String baseApp = intents.get(i).activityInfo.applicationInfo.dataDir;
    if (baseApp.startsWith(baseSD.getAbsolutePath()) {
      // This is on the SD card, do whatever with the app details
    }
    else {
      // This is on internal storage
    }
  }
}
</code></pre>

<p>Seems very low-brow, there must be a more proper way. Any help is appreciated.</p>
