forsaken_3479
forsaken_3479

Reputation: 1124

How to get the names of the launchers available on android?

So I want that when an activity is started ex:myactivity, it should get the names of all the applications that are launcher activities(ex:apex, nova,etc.) and list them. Is there any way to do that? I wan that my app should search for this and show a list of apps that can be set as default home launchers just like default app manager does.

<action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.HOME" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.LAUNCHER" />

Default App Manager
Nova Launcher

Now how do I make it so that when a button is clicked the setting activity for the current default launcher is opened? We can do that in Default App Manager so I know its possible but I am unable to get to it.

Upvotes: 0

Views: 442

Answers (1)

sockeqwe
sockeqwe

Reputation: 15929

You can retrieve a List of installed applications (that have HOME as category) by doing this:

Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_HOME);
List pkgAppsList = context.getPackageManager().queryIntentActivities( mainIntent, 0);

Upvotes: 3

Related Questions