Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6931537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:35:27+00:00 2026-05-27T11:35:27+00:00

Update I must target Android 2.1. I am trying to find out how to

  • 0

Update I must target Android 2.1.

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

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

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

  int count = intents.size();
  for (int i = 0; i < 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
    }
  }
}

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:35:28+00:00Added an answer on May 27, 2026 at 11:35 am

    You can use this code for checking where an app is installed:

    PackageInfo pi = pm.getPackageInfo("packageName", 0);
    
    if ((pi.applicationInfo.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) == 0)
       ; // stored on internal storage
    else 
       ; // stored on sd
    

    Be careful because FLAG_EXTERNAL_STORAGE is available starting from Android API 8.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Update II I Figured this out. When using google maps api, the model must
I am in a situation where I must update an existing database structure from
Update: Check out this follow-up question: Gem Update on Windows - is it broken?
I'm trying to run an android app from eclipse on my device (moto droid2).
I am trying to figure out what is wrong with this code, I need
I found this on android developers when i was trying to program a button:
I'm making an update script for a given data base. The script must Update
During uninstall progress, the installer displays below message: The setup must update files or
I'm trying to update position of entity collection (subentities) for a specific entity (master
Update: Solved, with code I got it working, see my answer below for the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.