Category Archives: Mobile development

Android development with Docker

A couple of years ago I wrote a post explaining how to develop and Android application inside a Docker container. After some time away from Android development I tried to follow the instructions in my post but they didn’t work quite well.

A lot has changed in the way Android applications are developed since my last post. Installing SDK elements is easier and Kotlin is the language of choice now. Luckily, once we put everything inside Docker, we don’t have to worry much about the environment and just code.

Create a folder for your project and add a Dockerfile inside that folder:

Read more »

Installable web apps

Since I discovered the web I believed it was the future. It gives everyone freedom to create the content they want to create and everybody can consume it no matter what operating system they are running. As technology moved forward, smartphones came to be. Smartphones are awesome, but with it came some regression. The creators of the platforms encouraged developers to create applications that only run on their platforms by offering an interface that was only available if you developed natively.

Browsers caught up pretty fast and came up with APIs for some of the most important features native apps provide (location, sensors, etc…). But there is still something about native apps that makes them somewhat better…engagement. It is not the same to have to open a browser and type a URL than to click an icon on your phone’s home screen.

Read more »

Android development with Docker

This post was written in 2016. I wrote an updated version on 2018. Android development with Docker 2018

I’ve been using Docker for developing servers and other web applications for a few months and I find it very comfortable. When I want to work on one of my projects I just need to clone the git repository and run a Docker command and everything is ready to start developing. The environment and all dependencies are installed inside the Docker container automatically and the developer doesn’t need to worry about a thing.

Today I decided to try to expand this concept to one of my Android projects. With Android development there are a few challenges to overcome. We need to get the correct development tools to build the project as well as a way to easily install the build into a device for testing. A few people have already done a lot of work on this subject so I’m going to use as much of their work as I can.

Read more »

Adding a drawer to your Android app

In a previous post I explained how to create a navigation bar for your Android app. I’m going to build on top of that example a drawer where we can put other options for the user.

Android provides a Drawer Layout that was specifically created for this purpose. Since we are going to be adding the drawer to my previous example lets first look at how the original looks:

Read more »

Create a navigation menu for your Android app

I finished building a hobby app a few weeks ago, but after getting all the functionality right I couldn’t help but notice that it looked horrible. I’m going to slowly try to make it less ugly starting with this post.

The first thing that I want to do is get rid of the default title bar because it occupies too much space:


Create the file src/main/res/values/style.xml if it doesn’t exist already and create a new theme with no title:

Read more »

Using the Gradle wrapper on your Android project

I have an android project I’ve been working on for a few weeks. I got a new computer recently and I wanted to work on this project. I downloaded the Android SDK and gradle. When I tried to run a build:

gradle assembleDebug

I got this error:

Gradle version 2.2 is required. Current version is 2.11. If using the gradle wrapper, try editing the distributionUrl in /home/you/repos/asdf/gradle/wrapper/ to

Read more »

gms.StatusHelper Status from wire: INVALID_AUDIENCE status: null

This weekend I decided to resume work on an Android project I had left behind. Once I had my environment set up I kept getting this error:

W GLSActivity: gms.StatusHelper Status from wire: INVALID_AUDIENCE status: null

After some googling I found the problem was that I was trying to call a google service from an app using a signature not registered in my project. I fixed it by going to the developer console for my project:

Read more »

Consuming a Google ID Token from a server

Before your server can trust that a Google ID Token actually comes from a valid user, you need to validate it. Validation of an ID token requires two steps:

  • Verify that the value of the aud field in the ID token is identical to your app’s client ID and that the iss is
  • Verify that the ID token is a JWT which is properly signed with an appropriate Google public key and has not expired

Anatomy of an ID Token

An ID Token consists of three sections separated by dots: header.body.signature. Here is an example taken from Google:


Read more »

Using Google+ id tokens from an Android app

I already wrote a post explaining how to sign-in to Google+ from an Android app. Now I want to be able to match all requests my app makes with the user associated with those requests.

Google uses the OpenID protocol and ID Tokens to make this possible. An ID Token consists of two JSON objects, base64 encoded, concatenated and cryptographically signed. This token can be attached to your requests so your server knows who is the user it should associate the request with. This token must be kept secret because anybody using it will be able to identify themselves as the user. To keep the token safe always use HTTPS and transfer it as an HTTP header.

Read more »

Google+ sign-in on Android

I’m building a system for which I want to use Google+ as authentication system. This will allow me to focus on my app instead of worrying about building a secure authentication system.

The first step to building this system is to have my Android app allow users to sign in with Google. We are going to build a simple Android app that allows users to Sign In using their Google+ account.

Scaffolding the app

To get started we can use a generator I created with yeoman. Once installed create an empty folder and run:

yo android-minimal

At this point you should be able to build and run a very simple app.

Read more »