Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - creating custom launcher

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)?

like image 535
Waypoint Avatar asked Aug 18 '11 11:08

Waypoint


2 Answers

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:

  • The GitHub of the minimal launcher I created may be helpful: finnmglas/Launcher
like image 116
finnmglas Avatar answered Oct 05 '22 22:10

finnmglas


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:

  • Old launcher source code
  • New launcher source code

Or take a look at launcher plus.

like image 38
David Olsson Avatar answered Oct 05 '22 21:10

David Olsson