How I published my first android app
Tags: android, kotlin, showdev, sideprojects
Published: 2020-04-20 22:05:19

After learning android development from scratch, I'm proud to announce that I launched my first application.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/dghs7t93i6udkn82mfnc.png)

**TL;DR**
You can download it [here](https://play.google.com/store/apps/details?id=lokiledev.moneyman)
I also made a website for it: [leboncalcul.fr](leboncalcul.fr)
Checkout [my other projects](lokile.dev)

# But why?
As you might not know, I'm an embedded software engineer (working on c++ code , low level libraries for an exoskeleton).
So yes it's pretty far from mobile apps, so why make one?

Well it actually started at work. We decided to make an android tablet application to allow users to configure the exoskeleton easily and wirelessly over bluetooth. 

Since no one in the company (a startup of ~70 people) knew how to make apps we decided to contract an agency to do it.

I won't explain in details but that went very poorly, and I lost a looot of time trying to remote manage a bad developer into finishing the first version of the app without me being able to read the code..

I lost so much time that I started thinking that I would probably have been able to learn how to make apps in the same time.

I remember reading an article on this site about project ideas and I saw one that seemed manageable: creating an expense manager. It's like the hello world of apps (with the TODO app).

# Learning new android with no priors

After reading some articles I discovered that Kotlin was actually the modern and proposed language for making android apps. That shattered my prejudiced view, I was thinking it was still java (and I'm not a huge fan of java).

Kotlin has really interesting features from someone coming from c++ and python.
The nullability checks and the extension functions for example are convenient. It also mixes functional programming with object oriented nicely. And allows to perform the same stuff with less code than in java.
I was surprised to discover that it runs in the jvm and is compatible with java.

I started by following this awesome tutorial from [udacity](https://classroom.udacity.com/courses/ud9012), I really recommend it.

# Android modern practices

I think I arrived at the right moment, it looks like recent releases of android frameworks are awesome, there are a lot of cool features and architectural patterns.
Since I never made android apps before, I was kind of lucky because I didn't had to learn all the legacy way.
They released the [architecture components libraries](https://developer.android.com/topic/libraries/architecture) which allows really clean and modular designs.

Let's see together some android specific terms and patterns which I learned about and tried to use in my app. I won't explain too much here since it's explained in the tutorial I linked. I can make specific articles to go deeper if requested.

## Application vs Activity vs Fragments

Android has a lot of specific concepts. Apparently older apps where composed of many activities. But now the recommended way is to have a single activity composed of many reusable fragments. It works for a simple app but you can still have many activities for more complex applications.

## Android application life cycle

Android has it's [own way](https://developer.android.com/guide/components/activities/activity-lifecycle) of managing the state of the activities and fragments and it's essential to understand it to make functional and optimized applications.
It's much simpler now thanks to LiveData and ViewModels.

## Navigation

You now have a graphical tool and an api for representing how to navigate in your application, between fragments and back and forth in the navigation stack.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/xkmxmeslro401tpn6k06.png)

## MVVM Pattern

The [Model-View-ViewModel](https://developer.android.com/jetpack/docs/guide#recommended-app-arch) design pattern allows to separate the data from the view, I had a hard time understanding the difference with the classic MVC.

## xml views and constraint layout

I loved this, you can either design your pages by editing an xml file, or there is a graphical tool for drag and dropping views. Then you can
define constraints for organizing the views with each other. I never saw that before and it's really clever.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/bfa3jo4k8r5f9sv5y4j2.png)

## DataBinding

`FindViewById()` is useless now. You can work on a generated *binding* object and access the views (like a text edit) directly as an attribute of the binding object!

Moreover, you can directly *store* objects from the code inside an xml layout!
A common pattern is to store the *ViewModel* instance. This combined with extension functions and binding expressions on the view allows to directly link the view to the model with almost no code, it's all generated at build time and when your data changes, the view updates naturally.

## LiveData

This feature is based on the Observer pattern, and aims at reducing the callback hell that was android before (apparently).
Basically you can make your database produce *livedata* of a certain type (a transaction for example), and tell the view to *observe* this data. Whenever the database changes, the view automatically gets updated. It's pretty powerful, but I needed some time to understand the flow of data.
And it's lifecycle aware.

## RecyclerView

The base of almost every application that must display a list of data, it has an interesting garbage collecting feature and you must define adapters between your data and a custom view to use it but it's powerful.

## Translations

Android has a system for storing strings in an xml file, and you can produce it in several languages, there is a built-in tool for editing it.
I made English and French versions.

# Publishing on the play store

This has been a long learning journey, it really helped to have a goal and a concrete project to work on. Having real problems to solve is essential. I discovered many interesting concepts that I can also reapply in other contexts. I understand better how native android apps are made now.
These new android features (especially in kotlin) are less documented and I often found answers for my problems in java or with older sdks so it slowed me more.

But I'm happy to have made it to the end and released my app.
I would love some feedback on it.
You can download it [here](https://play.google.com/store/apps/details?id=lokiledev.moneyman) It is free and no adds.
I also made a website for it: [leboncalcul.fr](leboncalcul.fr)

You can checkout my [portfolio](lokile.dev), I updated it with this project and other ones and added videos now :)

# Next Steps

Now I would love to see some people using it, I already collected some UI/UX feedback and made some mistakes. I limited the minimum sdk version for no reason, so the app is only available for 10% of devices...
I will make corrections soon.

Thank you for reading this and feel free to ask questions.