Home > Tricks & Tips > Get Default Launcher on Device

Get Default Launcher on Device

A simple snippet to get default launcher on device, which is checked “Use by default for this action” on Launcher selection dialog.

	public static ApplicationInfo getDefaultLauncher(Context context) {
		// first query all installed launcher
		ArrayList<ApplicationInfo> listAppInfo = getAllLaunchers(context);

		// the default launcher queried being stored here
		ArrayList<ComponentName> listDefault = new ArrayList<ComponentName>();
		// create list IntentFilter for Launcher apps
		final IntentFilter filter = new IntentFilter(Intent.ACTION_MAIN);
		ArrayList<IntentFilter> listFilters = new ArrayList<IntentFilter>();
		// query default launcher
		context.getPackageManager().getPreferredActivities(listFilters, listDefault, null);

		// check if default launcher
		if(listDefault.size() > 0) {
			for(ComponentName name: listDefault) {
				for(ApplicationInfo info: listAppInfo) {
					if(name.getPackageName().equals(info.packageName)) {
						// found yeah!
						return info;

		// not found any, no launcher set Default
		return null;

Refer to my previous post to get all install Launchers on device.



Pete Houston

Categories: Tricks & Tips Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: