Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the list of apps that have been installed by a user on an Android device?

I am using the following piece of code at the moment:

List<PackageInfo> packs = getPackageManager().getInstalledPackages(0);

but it returns Apps that have been installed by the both device manufacturer and me. How to limit it so that only the apps that I installed are returned?

like image 561
Raunak Avatar asked Jan 04 '11 21:01

Raunak


People also ask

How do I find app install history?

On your Android phone, open the Google Play store app and tap the menu button (three lines). In the menu, tap My apps & games to see a list of apps currently installed on your device. Tap All to see a list of all apps you've downloaded on any device using your Google account.


1 Answers

// Flags: See below
int flags = PackageManager.GET_META_DATA | 
            PackageManager.GET_SHARED_LIBRARY_FILES |     
            PackageManager.GET_UNINSTALLED_PACKAGES;

PackageManager pm = getPackageManager();
List<ApplicationInfo> applications = pm.getInstalledApplications(flags);
for (ApplicationInfo appInfo : applications) {
    if ((appInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
        // System application
    } else {
        // Installed by user
    }
}

Flags:

  • GET_META_DATA
  • GET_SHARED_LIBRARY_FILES
  • GET_UNINSTALLED_PACKAGES
like image 56
Zelimir Avatar answered Oct 11 '22 12:10

Zelimir