16

I am intending to develop custom Launcher for Android phone. I have searched web, but I haven't found any valuable information regarding creating "launcher" project. What does an android app needs for being at the top of the GUI (aka launcher)?

Gautam
  • 7,744
  • 10
  • 62
  • 104
Waypoint
  • 16,445
  • 37
  • 114
  • 168
  • 1
    When I hear the word *launcher*, I think of the button that opens the app. Is this what you are referring to? If not, could you provide a link to what you mean - such as to *Wikipedia*? – Phil Aug 18 '11 at 12:01
  • 2
    Yes, with Launcher I mean - an initial GUI, which loads when the android phone starts (we have standard launcher from Google, TouchWiz at Samsungu, or custom launcher like Launcher Pro and others) – Waypoint Aug 18 '11 at 12:03

2 Answers2

10

I saw this thread a while ago, before creating my own launcher.
Here are some crucial things I learned:


Declaring your app to be a launcher

David already mentioned the piece of code that determines your app as a launcher:

<category android:name="android.intent.category.HOME" />

Add this as an intent-filter to the activity your launcher will use for the home screen (in AndroidManifest.xml).

Launcher Issues

As a launcher will run all the time, you need to understand the activity livecycle to prevent issues (like this one).

If you want users (and yourself) to be able to constantly user the app (that's what you usually do with launchers), make sure it never crashes. In the case of a crash users will be taken back to the devices default launcher or other installed ones.

In short: Launchers are expected to be reliable.

Common launcher functions (users usually expect those)

1) A list of apps / appdrawer

From which all apps can be launched or modified. You can use packageManager to list the apps.

As generating such a list may take a while, I suggest you to do it asynchronously and save the list somewhere to speed everything up (which also is expected from launchers ^^)

2) Some settings to change the launcher

I had some users stuck in my launcher before implementing those ^^

You can open the devices launcher settings like this (in Kotlin):

// working in APIs newer than Lollipop
val callHomeSettingIntent = Intent(Settings.ACTION_HOME_SETTINGS)
startActivity(callHomeSettingIntent)

Bonus) An in-app tutorial

This may be useful if you have some features in your app that are not trivial, ways of launching apps that users don't know from other apps.

It also gets you way less messages from users asking how to interact with your software.


Resources:

finnmglas
  • 1,320
  • 4
  • 19
  • 32
9

Well, firstly you need to listen to the android.intent.category.HOME intent. Here are some links with full source code which you can have a look at:

Or take a look at launcher plus.

David Olsson
  • 7,932
  • 3
  • 27
  • 38