How I hacked Codementor to build an Android app
How was your December? Mine was pretty productive and exciting, mostly because I finally finished my Android app for Codementor.
a hacker is someone who seeks and exploits weaknesses in a computer system or computer network
From Hacker (computer security) — Wikipedia.
How it started
It started from a need. I needed to communicate with my mentees better. I needed to respond to their messages quickly, whenever and wherever I was. Before:
- their website was responsive, but using the chat inside a browser felt very cumbersome
- they did have an iOS app, but nothing for Android
- when I received a message, I would get an email alert but only after 5 minutes or so
I wanted to:
- receive new message alerts instantly
- be able to respond to messages quickly
- have an app to make everything easier
So I set off to create a beautiful chat app for Codementor using Material Design and the Firebase SDK for Android. I wanted to present it to the Codementor team and, eventually, publish it in the Play Store.
Analysing my target
I started with a bit of analysis of their current web app. From just a quick look in the source code of the home page, I could tell they were using AngularJS and Firebase.
This was good news because if I could send and receive messages using their platform, I could definitely create my own client and do the same.
Also by looking at their app’s source code, I learned they had a minimal API. However, there was no endpoint for querying messages, so I had to look elsewhere. I downloaded a Firebase JavaScript library to try to connect to their Firebase app. I used my token I found in the source code to log in, and it worked!
Even though I had access to their Firebase store (which is just a huge JSON object), I had no idea how it was structured and what I’d have to look for, so I dug deeper. I set a callback to listen to changes to the data (parts of the JSON) I could access (in Firebase you don’t query data, you just listen to it). I continued to use the platform, I sent and received messages, then I noticed what parts of the data changed. I learned what a message’s JSON representation looked like, how it was stored, and how to read all my messages.
I still needed to learn how their AngularJS app worked, so I downloaded and unminified some JavaScript files it used. After I read their code, I found how messages were marked as read, how they were created, and how they were sent. Additionally, I used Tamper Chrome to alter the app’s JS files. I was making small changes, running, adjusting, running again, and so on, to understand some parts of the code that were not clear to me.
Building
I started building the app in September. It took almost three months because I worked on it in my free time; I kept adding things, improving the UI, fixing bugs, adding more things, and refactoring.
Besides learning how to use the Firebase SDK for Android, I also learned and implemented the Model-View-Presenter pattern. I carefully wrote every piece of code, as I always do. I refactored a lot, and I think the only shortcoming is the lack of tests.
When the app was finally done, I was so proud. I managed to create a simple interface which was working well, with smooth animations and the official brand colours.
The login screen:
And the conversations list:
Say hello to just a few of my mentees :)
Publishing
Since the app was finished (well, just ready for a release, not completely eternally finished) I wanted to publish it in the Play Store.
I sent my app to the Codementor team and they liked it. They considered using it as their official app, but they opted for their own cross-platform app built with web technologies. The new app is not perfect, but it has all the things I needed: instant notifications, messaging and ease of use.
I love this screen.
My app’s source code is published on GitHub. You can get the official Codementor app for Android from the Play Store.