简体   繁体   中英

Android application unique User ID installed on smartphone

How do I get list of android apps ID which were installed on smartphone?. All android application will have its unique ID. Is it possible to retrieve ID?

Android unique app id is its package name

You can get the user installed apps like this:

List<PackageInfo> packList = getPackageManager().getInstalledPackages(0);
for (int i=0; i < packList.size(); i++)
{
    PackageInfo packInfo = packList.get(i);
    if (  (packInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0)
    {
        String appName = packInfo.applicationInfo.loadLabel(getPackageManager()).toString();
        Log.e("App № " + Integer.toString(i), appName);
    }
}

Or all the apps (including the system apps):

List<PackageInfo> packList = getPackageManager().getInstalledPackages(0);
for (int i=0; i < packList.size(); i++)
{
    PackageInfo packInfo = packList.get(i);
    String appName = packInfo.applicationInfo.loadLabel(getPackageManager()).toString();
    Log.e("App № " + Integer.toString(i), appName);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM