Android Music Player Controls on Lock Screen and Notifications

If you are just starting out, I recommend reading the first (basics about Media playback on Android) and second (Creating a Service to Play Music in the background) parts before proceeding. This post will discuss how to show Media Player controls on the lock screen and the notifications. Managing a…

Playing music in the background on Android

If you haven't read the first part, read it first to learn the basics about Media playback on Android. Playing music in the background If you want your media to play in the background while the user is interacting with other applications, then you must start a Service and control…

Why I use Kotlin for Android

Kotlin is a statically typed language developed by JetBrains that targets the JVM. If you have worked with Java before, you know how verbose it could be. When Apple released Swift, developers rejoiced for a better alternative to Objective C. Kotlin could be that alternative for Android developers working with…

Refresh OAuth access token with Retrofit, RxJava

A very common use case when working with OAuth is to refresh the auth token. One way could be to do it periodically. A much simpler way, although, is to try refresh the auth token when you see a 401 response for an authenticated user. This is very straightforward to…

Realm for Android

Realm is a mobile database: a replacement for SQLite & Core Data that works for both iOS and Android. It has a really concise API and works extremely fast. Let's see how we define a model in Realm: public class User extends RealmObject { @PrimaryKey private int identifier; private String firstName;…