I am following the code given in the below link:
http://xjaphx.wordpress.com/2011/06/12/create-application-launcher-as-a-list/
to list out installed application on my phone.
But the problem here is that it is listing all the applications.
All system related apps also like.
Network Location, Sound Search for Google play, Launcher, Package access helper
How do I filter not to show non-launchable apps?
I tried the following:
Instead of this
c.getPackageManager().getInstalledApplications(PackageManager.GET_META_DATA)
I tried:
c.getPackageManager().getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES)
But same result.
Can somebody help me out with this please?
Thanks!
UPDATE:
Thanks to MH for guiding. Now I am able to see only installed app's from playstore. How to do also get System default apps like Gmail, Clock, settings, Google maps etc.
Here is what I tried:
List<ApplicationInfo> appInfos = c.getPackageManager().getInstalledApplications(PackageManager.GET_META_DATA);
List<ApplicationInfo> userAppInfos = new ArrayList<ApplicationInfo>();
List<ApplicationInfo> systemAppInfos = new ArrayList<ApplicationInfo>();
for (ApplicationInfo info : appInfos)
{
if ((info.flags & ApplicationInfo.FLAG_SYSTEM) != 0)
{
systemAppInfos.add(info);
}
else
{
userAppInfos.add(info);
}
}
return userAppInfos;