Make Your Own Custom Android Launcher using Flutter
Tags: android, ios, showdev, vscode
Published: 2020-09-23 09:30:48

![Ubuntu Launcher](https://dev-to-uploads.s3.amazonaws.com/i/0gv5rs2m1c0qetbl56gx.gif)

###### Have you ever thought of making your own stuffs and use them?

Like your Own

- Operation System !
- Programming Language !
- Library !
- Framework !
- Apps !
- Games !

I'm that kind of person who was always interested in making applications which are **integrated** to the system (literally Applications) not business or commercial applications and still i am :3

I have always dreamt about things of my own...

So once I thought to make my own **Android Launcher** as I'm using Android Phones.

At first I thought it's something very hard and I won't be able to make a launcher.Then I found it supper easy!

## Today i am going to discuss about how to nake your Android Launcher !

Let's start!

I am using **Flutter** which is a **Cross Platform Framework** of **Dart** Made by **Google**.

There is a big community of **Flutter** to make **cross** platform applications such as **Android**,**IOS**,**Desktop** and **Web applications**.

If you haven't installed flutter yet then have a look at their doc which is very user friendly and well decorated.

[Install Flutter](https://flutter.dev/docs/get-started/install?gclid=CjwKCAjwwab7BRBAEiwAapqpTF1KuSOnthNqucXzsGFZK0QM5L9xw4C_bkR_zzK3GJhAsFd2K49RDxoC22QQAvD_BwE&gclsrc=aw.ds)

**Note :** I am using **Visual Studio Code** as a Editor or IDE and prefer **terminal** and command line activities.

### Lets create a flutter application

- Command in terminal :

> flutter create -i objc -a java custom_launcher

**Note :** This command will create a application named `custom_launcher` and the **native** code for **Android** will be **java**

If you prefer **Kotlin** then just use -

> flutter create custom_launcher

###### A flutter app will be created with similler file Structure:

![files](https://cdn-images-1.medium.com/max/800/1*8KDHRxRAuGLvrvpp1UVAuQ.png)

We will code in `main.dart` file.

First We will need to edit some codes in the `AndroidManifest.xml` file. That will make our **launcher** different from **normal Android Applications**

Manifest file location :

![xml](https://cdn-images-1.medium.com/max/800/1*FK9wa8Ek_spB0hZSGMckjA.png)

- Add these lines in `AndroidManifest.xml` file under `<intent-filter>` section :

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

```

Now If you **run** your app , it will appear as a **Launcher**.

Or **Press Home button** of your android phone and it will ask to set it as **default** launcher.

- ![launcher](https://cdn-images-1.medium.com/max/800/1*_1VULV0nBwyQSwK4fi5GLQ.png)

##### Congrats You have made your launcher :D

Yup Seriously ! It is that easy !

Now as a Flutter Application **developer** I hope you are able to do some of your own customizations.

I know you are concert about how can you show the **installed applications** in your custom Launcher.

Let's do it:

### Interact with the Applications installed in Phone

To do so we will use a flutter plugin named **`device_apps`** which will give us a `List<application>` where all the necessary informations will be given.

-  First import `device_apps` into your dart file :

```dart
import 'package:device_apps/device_apps.dart';
```

-  Get the list of apps available in your phone :

```dart

List<Application> apps = await DeviceApps.getInstalledApplications();

```

- You can send some parameters too :

```dart

List<Application> apps = await DeviceApps.getInstalledApplications
(
    includeAppIcons: true,
    includeSystemApps: true,
    onlyAppsWithLaunchIntent: true,
)

```

This will return something like that :

![20data](https://cdn-images-1.medium.com/max/800/1*lwWFeWLXJNDNw9Wytr6EyQ.png)

##### It provides :

    App Name (String)
    Apk File Path (String)
    Package Name (String)
    Version Name (String)
    Version Code (int)
    System App ? (bool)
    Install Time (int)
    Update Time (int)
    Application Catagory (Catagory Type)

It also provides `icon` as `ApplicationIcon`.
To access icon you have to use that `Application` type as `ApplicationWithIcon` and check that the **app has a icon** first.

**Note :** **icon** is a **Uint8 List** type.

Now You have your data so do what ever you want !

### Let me show you how you can use them

-  Let's traverse all the apps we get before :

```dart

for (int i=0;i<apps.length;i++){
    Application app = apps[i];
}

```

- Extract the application name :

```dart

Text(app.appName)

```

- Use Icon :

```dart

app is ApplicationWithIcon ? CircleAvatar(
 backgroundImage:
     MemoryImage(
   app.icon,
 ),
)

```

**Note :** If you are not able to access app.icon then use this -

```dart

ApplicationWithIcon icon app as ApplicationWithIcon;
icon = icon.icon;
```

### More things you will want to do :

- Check if an application is installed :

```dart

bool isInstalled = await DeviceApps.isAppInstalled('packageName');

```

- Open an Application :

```dart

DeviceApps.openApp('packageName');

```

###### Apps can be shown like this :

![](https://cdn-images-1.medium.com/max/800/1*BxoraA9qXR13AG8lM6vr-g.png)

I have made an Android Launcher which is lightweight and Fast.You can have a look and If you like then give me a star :v

Source Code available : [Ubuntu Launcher](https://github.com/jspw/Ubuntu-Launcher)

Apk Release : [Install](https://github.com/jspw/Ubuntu-Launcher/releases/tag/2.0.0)

Happy Coding :D

Contact with | Follow me on : [LinkedIn](https://www.linkedin.com/in/mehedi-hasan-shifat-2b10a4172/) [Twitter](https://twitter.com/mhshifat757) [Facebook](https://www.facebook.com/rio57mh/) [GitHub](https://github.com/jspw) [Quora](https://www.quora.com/profile/Mehedi-Hasan-Shifat) [Dev](https://dev.to/mh_shifat) [Medium](https://medium.com/@mhshifat757)