Vinod Kumar
Vinod Kumar

Reputation: 19

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);

Upvotes: 1

Views: 450

Answers (1)

Lakhwinder Singh
Lakhwinder Singh

Reputation: 7209

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.

Upvotes: 0

Related Questions