You looked at: PackageManager.resolveActivity () ,
Intent intent= new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); ResolveInfo defaultLauncher= getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY); String nameOfLauncherPkg= defaultLauncher.activityInfo.packageName;
Make sure you use the HOME intent, as you will of course have a launcher at home.
Not used, but you can try it with a different flag, i.e.
PackageManager.GET_INTENT_FILTERS instead
PackageManager.MATCH_DEFAULT_ONLY
FINAL DECISION:
PackageManager API,
public abstract int getPreferredActivities (List<IntentFilter> outFilters,List<ComponentName> outActivities, String packageName)
source share