I'm trying to get every launchable applications in my device using this method:
apps = new ArrayList<>();
Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
List<ResolveInfo> availableActivities = manager.queryIntentActivities(intent, 0);
for(ResolveInfo ri:availableActivities){
AppDetail app = new AppDetail();
app.label = ri.loadLabel(manager);
app.name = ri.activityInfo.packageName;
app.icon = ri.activityInfo.loadIcon(manager);
apps.add(app);
}
I tried to print the label and package name of those application and found this:
Contacts com.sonyericsson.android.socialphonebook
Phone com.sonyericsson.android.socialphonebook
They have different app label yet the same package name. When I tried to open the apps, both of them open Contact app.
Is there any way to differentiate them? Or did I use a wrong method to get list of application?