简体   繁体   中英

How can I get the cloned apps in android java using packageManager?

I'm working on a new android launcher app and I'm successfully able to retrieve all installed apps using getPackageManager() into a list view.

However, now I'm encountering a problem while testing on some phones which allow to clone you apps, like I can have Whatsapp1 and Whatsapp2(cloned). Now my code does not retrieve the second whatsapp and shows only one.

I have already tried setting different intent flags to my packageManager but it still did not work.

First Method:

final PackageManager pm = globalContext.getPackageManager();
List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);

Second Method:

PackageManager manager;
manager = globalContext.getPackageManager();
Intent i = new Intent(Intent.ACTION_MAIN, null);
i.addCategory(Intent.CATEGORY_LAUNCHER);
List<ResolveInfo> availableActivities = manager.queryIntentActivities(i, 0);

No, you cant, because Package Manager only differentiates the apps on the basis of Package name eg: com.whatsapp Both the Whatsapp1 and Whatsapp2 have the same package name.

And I think the clone app feature is purely a Manufacturer thing.

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