小编use*_*054的帖子

Can two different apps have the same packageName?

I have this code to get a list of all apps on system:

    PackageManager pm = getPackageManager();

    Intent mainIntent = new Intent(Intent.ACTION_MAIN);

    List<ResolveInfo> installedApps = pm.queryIntentActivities( mainIntent, 0);

    for(ResolveInfo elem : installedApps) {
            String PackageName = elem.activityInfo.applicationInfo.packageName;
            Log.i("TAG",PackageName);
    }
Run Code Online (Sandbox Code Playgroud)

But the result in installedApps shows many repeated PackageNames. Is this possible? It's 'cause a "failure" of the intent or because many apps packageNames have the same name?

android packages package

8
推荐指数
3
解决办法
9499
查看次数

标签 统计

android ×1

package ×1

packages ×1