Stop It! Create audio bookmarks on Android

This posts presents my open source Android app named Stop It! which lets you create bookmarks for audio tracks you play with third party Android audio players, e.g. music or podcast apps.

Introduction

Bookmarks are a well-known concept from real (or virtual) books, and web sites. You have certainly used them thousands of times already. Essentially, they mark a specific location in the medium, so that you don’t have to remember it, and can resume consumption at a later point. For electronic bookmarks, bookmark management is typically integrated into the reader app, e.g. your e-book reader or web browser.

Interestingly, audio app makers either forgot to add such a functionality to their app, or it is complicated to access. For instance, liking / bookmarking a song on Spotify requires unlocking your phone and touching the screen a few times. And if such functionality exists, it will be imprecise, missing the exact time stamp within the audio track. There are only a few exceptions, namely audio book apps, where the ability to resume playback from the last paused position is vital. Examples include the Audible app, or Smart AudioBook Player (Android).

The inception of Stop It!

I listen to music and audio podcasts whenever I’m on the move. I use different audio apps, such as podcatchers or music apps. Countless times I’ve experienced the need to create a quick bookmark. I’d like to remember the currently playing song, or there was an inspiring fact, quote or product recommendation in one of the podcast episodes. However, none of the apps I use support creating bookmarks. And if I’m currently busy paying for goods in the supermarket, or riding my bike, I simply don’t have the time to pause the playback, pull the phone out of my pocket, turn on the screen, draw the unlock pattern, read and remember the podcast title, episode name and time stamp, open the launcher, search for a notes app, create a new note, type in the data I just remembered, and press save. There is no way this is going to happen …

That’s why I decided to create my own app that creates and manages audio bookmarks for me. These were my initial requirements:

Stop It! screen shot
  • Ability to create bookmarks for any third party audio app, with an easy, fast trigger mechanism. I decided that pausing playback and immediately resuming it again will be the trigger. I can do this with my BlueTooth headset controls. The bookmark app will need to constantly run in the background to detect this series of playback events somehow.
  • Bookmarks should be stored persistently, and contain the audio app package name, the track name and artist, the time stamp (precise to the second) and potentially other meta-data. That’s the data I need to manually (or automatically) resume playing back the track later.
  • Show all bookmarks in a simple list view, where I can delete them or resume playback of a bookmark, if technically possible.

I have turned my thoughts into an actually working Android app called Stop It! (GitHub). It is not available on Google Play, but you can download a pre-built APK from the GitHub releases page. This side project not only solved my need, but it helped me brush up my Android skills, which I’ve not used since 2014. I started developing the app in Java, but quickly migrated to Kotlin. I did not regret this step, as the language is indeed much nicer to use.

How it works

Stop It! settings

To create bookmarks, you need to constantly run a background service that receives information about changes of the playback state and audio meta-data. My initial approach was to use a BroadcastReceiver that receives com.android.music.playstatechanged Intents, which contain both the playback state as well as meta-data. This seemed to somewhat work, but I soon replaced this mechanism with a better one. The problem with the first approach was that devices running Android 8+ would no longer receive such Intents. Also, these kinds of Intents were not standardized, such that crucial information was sometimes missing.

The new approach uses the Media API which pretty much all modern video and audio players implement. You can find out more technical details on the GitHub project wiki. This solution turns out to be very reliable, but requires the user to provide Stop It! special access to all notifications flowing through the system. This is not hard to achieve from an UX perspective, but may raise suspicion for some users. While developing, I found that users will need to tweak certain settings. In particular, timing-related settings require tuning, e.g. the amount of seconds that may pass at most, between pausing and resuming playback, to trigger the bookmark creation. The screen shot shows an excerpt of these settings.

In case you’re using an Apple device, you may wonder if a similar app could be made for iOS. From what I understand, the short answer is no. iOS is a very restricted operating system, where accessing the necessary information about the state of other apps in the background is basically impossible. The only viable solution is to build an app that can create bookmarks for selected audio apps which offer an SDK, e.g. Spotify.

What’s next

While Stop It! already does what it needs to do for me, I am aware that other users will have additional needs. One important feature is the ability to resume playback for a bookmark. Due to technicalities (see here) this is not easy, and requires testing and adjusting our code for each third party audio app. Currently, only Castbox and Pocket Casts are supported, with further apps such as YouTube or Spotify being on the roadmap.

Before publishing the app to the Play Store, I would also like to improve the logo of StopIt! The app will also need bug reporting functionality, because unexpected, weird things will go wrong on other Android devices.

Try it & contribute

If you like the idea of effortlessly creating bookmarks for any audio tracks, just head over to the GitHub releases page and download the latest version. If you’re not an Android developer and not familiar with APK files, you will need to enable installation from unknown sources (instructions). If you like the app and want to contribute, feel free to submit issues or pull requests on GitHub, or get in touch we me directly.

Leave a Comment