The problem background: above code is working fine on previous versions of Android. I want to query the app which already installed in device.
My code:
public static List<String> getHomes() {
List<String> names = new ArrayList<String>();
PackageManager packageManager = context.getPackageManager();
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
List<ResolveInfo> resolveInfo = packageManager.queryIntentActivities(
intent, PackageManager.MATCH_DEFAULT_ONLY);
for (ResolveInfo ri : resolveInfo) {
names.add(ri.activityInfo.packageName);
}
return names;
}
And the above code is working fine on previous versions of Android.
Questions: But it didn't work in Lollipop
So, is anybody has to solve this problem? or is there any other method can replace it?
Thank You~