0

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.

vishalmullur
  • 1,094
  • 4
  • 14
  • 32

1 Answers1

3

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);
sockeqwe
  • 15,574
  • 24
  • 88
  • 144
  • Yes I have updated my post: mainIntent.addCategory(Intent.CATEGORY_HOME); is what you are looking for. – sockeqwe Jul 04 '13 at 16:26
  • But im not sure if your app can set / have permission to set the default home launcher ... – sockeqwe Jul 04 '13 at 16:28
  • I have already done that. So I define pkgAppsList as a listview and show the result, right? – vishalmullur Jul 04 '13 at 16:32
  • 1
    I don't know what you wanna do :) or what your app should look like, but yes, put the pkgAppsList in an BaseAdapter and display it in a ListView – sockeqwe Jul 04 '13 at 16:41
  • 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. – vishalmullur Jul 04 '13 at 20:32
  • So your question is, which activity do you must start to bring the launchers settings activity on screen? You must do that the way, like you will do with any other activity: Use an Intent. In the intent you need to specify the package name and Activity name of the Settings Activity of the selected launcher. But there is no standard Intent you can send to make it work with every launcher. So you may need to check for every launchers setting activity ... – sockeqwe Jul 05 '13 at 08:27
  • Oh yes thanks I might do that but for that would I have to extract to take a look at the package names of all launcher activities? – vishalmullur Jul 05 '13 at 14:33
  • Okay actually there is a clever work around for this. [link]http://stackoverflow.com/questions/13167583/clearing-and-setting-the-default-home-application-solved[/link] – vishalmullur Jul 05 '13 at 14:46