What is a Launcher App?

A Launcher app is the app that comes up when you press the home button or when you start your Android device.
The main purpose of this app is to start other apps, but it can also host widgets from other apps.
I created a small app you can use to learn how to create a launcher app. You can find the Github project here

How does it look like?



A WidgetScreen with a Widget

A WidgetScreen with a Widget

My demo app has two fragments.
Homescreen: The homescreen with a list of the installed apps. Here you can start other apps.
Widgetscreen: Here is just a button that will open the widget picker. The selected widget will be displayed below in the FrameLayout.

How to start?

To get your app registered by the Android OS as an launcher app, it takes nothing more than to add these intent filters to your AndroidManifest.xml:



After adding the intent filters, you can choose your app as an standard launcher.


How to get a list of the installed apps?

To get the list of the installed apps you need to use the PackageManager class.

This list will be passed to a RecyclerView.
The PackageManager provides methodes to get the needed information about a ApplicationInfo.

AppName: getPackageManager().getApplicationLabel(ApplicationInfo info)
AppIcon: getPackageManager().getApplicationIcon(ApplicationInfo info)
AppIntent: getPackageManager().getLaunchIntentForPackage(ApplicationInfo info)


Pick a widget

Start an intent with the AppWidgetManager to open the Widget Picker.



Receive the result

In onActivityResult you check if the user picked a widget or pressed the back button.

Show the widget

The Widget is inside a AppWidgetHostView. Add this view to a layout.

That’s all it takes to create a very simple launcher app. I hope the information is useful for you.

Example Project

You can find the Github project here