Home
> Tricks & Tips > Query all installed Launcher Applications
Query all installed Launcher Applications
The tip for making this happen is that all launchers register these two categories in Manifest
+ CATEGORY_HOME
+ CATEGORY_DEFAULT
and this is my snippet to query ’em all.
public static ArrayList<ApplicationInfo> getAllLaunchers(Context context) { // create new intent final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); // all launchers register these two categories mainIntent.addCategory(Intent.CATEGORY_HOME); mainIntent.addCategory(Intent.CATEGORY_DEFAULT); // query normally final ArrayList<ResolveInfo> pkgAppsList = (ArrayList<ResolveInfo>) context.getPackageManager().queryIntentActivities( mainIntent, 0); // you can return 'pkgAppsList' // anyway, I need the following information, // so I just query what I need ArrayList<ApplicationInfo> listAppInfo = new ArrayList<ApplicationInfo>(); for(ResolveInfo info: pkgAppsList) { listAppInfo.add(info.activityInfo.applicationInfo); } // return return listAppInfo; }
There you go, gotta do something with it.
Enjoy and have fun!
Cheers,
Pete Houston
very help full tutorial, thanks for everything,
I have small query, like
how can I make my launcher as default launcher ?