I open sourced my first android application
Tags: android, opensource, kotlin, showdev
Published: 2020-07-09 19:19:16

---
title: I open sourced my first android application
published: true
description: Open sourcing the my first android app
tags: android, opensource, kotlin, showdev
//cover_image: https://direct_url_to_image.jpg
---

I have recently started to move a lot of my personal stuff from private repos into public ones on my GitHub profile. Always admired people who create, maintain or contribute to open source projects and I wanted to do so for such a long time. And have now decide to publish the source code of the very first android app I have developed. The app was completely rewritten to support and use the latest features of Android, such as using [Room](https://developer.android.com/topic/libraries/architecture/room)  for the database handling and [Kotlin](https://developer.android.com/kotlin) as the language of choice.

### Backstory 

When I first started getting into Android development I was wondering what kind of application I should create to help me better learn and understand it all. So one day I was scrolling trough my Facebook's posts and notice one groups name kept popping  up more and more. It was a group someone create that showed all the names and password of WiFi network in my city. The networks were from coffee shops all around town and people were constantly submitting new ones. But one thing that I found wrong with that approach was that you needed to remember all the networks and their passwords or you needed to go online => go to facebook => check for network name and password  => and then connect to network in order to get online. Notice the problem ? 

I started to wonder how I could make all that info available offline and on my phone, but also be able to update them once I actually connect to some network. 

### [Banja Luka WiFi](https://play.google.com/store/apps/details?id=com.gac.banjalukawifi)

And that is how the idea came to me to create my first Android app that holds all the WiFi networks available in that faceboook group. First I started by collecting all the networks in the posts and comments into a single csv file to import all that information into a database. Once I had a database ready I started working on the API that would allow me to communicate with the web server in order to download all the information from it and then store it in my phone. 

So I started looking up tutorials and resources on how to create an Android app and what do I need for it. At that moment the most recommended option was Eclipse with a plugin for android app development. So I downloaded it and set it up, started working on the code and got a `Hello World` printed on the screen. :)

Later that year the [Android studio](https://developer.android.com/studio/) version [1.2](https://en.wikipedia.org/wiki/Android_Studio#Version_history) was released and I switched to using it as it was more intuitive and had a nicer UI in my opinion. 

After some trial and error I was able to create an app that was able to check if the user was connected to the Internet and than send a request to my API to retrieve all the networks from the database. Once the networks were downloaded, they were stored into an SQLite database and were available to the user even if they were offline. 

The app consists of several screens ([Fragments](https://developer.android.com/guide/components/fragments)): 
* List of all the networks inside of a [ListView](https://developer.android.com/reference/android/widget/ListView) (now using [RecyclerView](https://developer.android.com/jetpack/androidx/releases/recyclerview)) and a search box that allowed you to search for a network by its name
* Add / edit form that allows you to submit a new network or edit an existing one if the information was outdated (password changed, incorrect address, etc)
* Submit a bug within the app itself or request for a network to be removed from the app DB 
* Map showing you the location of all the networks, as that information is being collected in the add/edit form
* About the app screen

There was also a feature at one point but later it got removed as I wasn't too sure about it, but in short it allowed the app to scan for networks around the user and check if the user is not connected to any network at that moment but found a network around them that matched the name in the database it would try and connect directly to that network without the user having to do anything. When running a test on the streets I was able to stay online while walking trough the main street in my city without any problems. The app would find the first network and connect me to it, once that connection was lost it would look for the next network and connect me to it, and so on as long as it could find a network to connect me to. But once google started to implement some restrictions on networks and background tasks I removed that feature.

After I had the first version of the app that I was satisfied with I started looking for way to monetize it and decided on using googles [AdMob](https://admob.google.com/home/) for that. 
 
 The app with the version 3.0 of the source code is available on the [Google Play store](https://play.google.com/store/apps/details?id=com.gac.banjalukawifi) for anyone to download it and check it out. But the networks listed in the app are for my city only and all new networks that get added have to be manually approved by me in order to prevent spam and some other stuff. I was thinking of creating a new app that could be used by the whole world and would have more features and would show networks based on your current location. But I don't have time for it so I don't know when or if I'll get to that idea. 

Any suggestion, feedback or PRs are welcome. If you wish to help out, but not sure what to do, might I suggest by adding a translation for your own language to the app. Or maybe try and optimize some code as there is legacy code that just got ported to the new version as I didn't want to rewrite the whole app from scratch as it would take too much time. 

The full source code can be found here:
{% github gigili/banja-luka-wifi no-readme %}

<a href='https://play.google.com/store/apps/details?id=com.gac.banjalukawifi&pcampaignid=pcampaignidMKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1'>
<img width="25%" alt='Get it on Google Play' src='https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png'/>
</a>