Why can’t Android get notifications right during media playback?

Advertisement

Devices powered by Google’s Android operating system are fairly well rounded. They’re a good phone. They’re a decent time keeper and appointment tracker. They go a great job at helping you keep up with your social networks and email. They even help you relax to your favorite music. What do all these have to do with one another? And what do any of them have to do with a duck?!

Ever since Google Play Music All Access was announced (and I bought into the monthly subscription) I’ve been listening to a lot of music — a LOT of music. Most of the time everything works great. Sure, not all the songs I want are included in the library, and listening to a radio station more than a couple times can get boring because the playlist doesn’t seem to change, but all those are trivial when compared to one glaring problem — and Play Music isn’t alone. Virtually every media player suffers from one fatal feature, er… flaw when it comes to interacting with Android notifications.

The fatal feature

quiet hours

Please! Let me sleep!

While traveling around the world to bring our readers news, reviews, and video of the latest and greatest devices to be announced, Michael Fisher and Anton D. Nagy noticed something “odd” when they were trying to listen to their music. It’s something you’ve probably noticed, too, but perhaps not as blatantly annoying as what we in the tech industry go through almost every day.

We’re being bombarded by alerts all the time. There are times when we get an alert every few seconds. From email and Tweets, to Facebook and Google+ statuses, calendar events, instant messages, hangout requests, and more, there are times when our phones and tablets don’t shut up for hours. (I think CyanogenMod’s “Quiet Hours” feature may have saved my marriage on more than one occasion.)

Therein lies the problem. Android has a feature (which we’ll talk in-depth about in just a moment) that reduces the volume of your audio stream so you can “hear” the incoming alert or notification. Then, after a moment, the volume is restored to normal. This is a feature, but when you’re getting an alert every several seconds, it makes listening to your music intolerable.

Get to the duck already!

Since Android has been able to multitask since the very early days, it’s possible for more than one audio “event” to happen at the same time. Google has this to say on the Android Developers site:

“With multiple apps potentially playing audio it’s important to think about how they should interact. To avoid every music app playing at the same time, Android uses audio focus to moderate audio playback — only apps that hold the audio focus should play audio. … Before your app starts playing audio it should request — and receive — the audio focus.” 

Okay, that makes sense, audio focus keeps you listening to what you’d expect to be listening to, but what about when another app wants “focus”?

The best example of this is listening to music when you get an email, calendar alert, or a Facebook “pop”. With your music set to a comfortable listening volume that audible alert can get lost among all the other audio. Google’s advice? In addition to requesting audio focus, apps should know how to listen for a loss of audio focus, then “respond appropriately”.

To confuse things even more, apps need to request either “transient” or “permanent” audio focus. Transient focus is for apps that expect to play audio for a short time, like when you’re using your GPS app to navigate around town and audio instructions come only when you’re approaching a turn. Permanent audio focus is for when an app plans on playing audio for the “foreseeable future”, like when you’re listening to your music.

duck code

In case you were wondering, this is what a duck looks like in code.

When an app requests transient audio focus, they have an additional option: whether or not to enable “ducking”. Other than the tie-in to the leader image, what’s “ducking” you ask?

Ducking is just like it sounds. When someone throws a rock at you, you’re probably going to duck out of the way, then pop back up again. The concept is the same here: when your device gets a new notification, your audio may “duck” out of the way.

A well-behaved audio app will silence its playback immediately when it loses audio focus, but that can be pretty jarring. By requesting a transient audio focus that supports ducking, that app tells the other app that it’s okay for it to keep playing, as long as it lowers its volume until the focus returned.

In our GPS example, you’re busy driving down the road listening to the latest thing from Jonathan Coulton and, as you approach your next turn, the GPS software requests transient audio focus, your music “ducks down” and out of the way (but keeps playing) while your GPS says “Just ahead, turn right”. After a brief pause, JoCo is back at full volume signing about some guy with fancy pants again.

That’s how it’s supposed to work. Google sums up the behavior for us:

“Ducking is the process of lowering your audio stream output volume to make transient audio from another app easier to hear without totally disrupting the audio from your own application.”

Something went terribly wrong

How could something that sounds so good go so terribly, terribly wrong?

The “ducking” feature works exactly like it’s supposed to. When you’re getting notifications infrequently, the dip in audio volume is obvious — it’s supposed to be. Your cognitive focus is changed to the notification, that way you have the option to take action on it, or not. But you can’t blame your Android for not notifying you. The experience is jarring, by design.

Again, when you’re getting a few notifications, you can put up with the “feature”, but when you’re getting dozens of alerts, your audio may be ducking more than it’s playing — and therein lies the problem.

Can’t something be done?

In the coding community this is called “works as designed”, so it’s not a bug, it’s a feature.

I think its implementation is a bit rough, and rather than “ducking” as Android does now, the audio should plie. Where “ducking” seems sudden and abrupt, a plie is elegant and beautiful — well, “gentle” at least. Until Google changes the “duck” behavior to be more graceful, there’s not a lot that can be done…

But there is one thing.

If you should find yourself in a “lots of alerts” moment, or just don’t want your music to be interrupted by those pesky notifications, go into Settings, Sound, Volumes, and mute your Ringtone & notifications volume. Now your notifications won’t play any audio at all, so the “ducking” behavior of your focus audio won’t be triggered, and you can finally listen to your music in peace.

Just don’t blame me if you miss an important notification.

Image credit: (cc) Robert Couse-Baker

Advertisement

What's your reaction?
Love It
0%
Like It
0%
Want It
0%
Had It
0%
Hated It
0%
About The Author
Joe Levi
Joe graduated from Weber State University with two degrees in Information Systems and Technologies. He has carried mobile devices with him for more than a decade, including Apple's Newton, Microsoft's Handheld and Palm Sized PCs, and is Pocketnow's "Android Guy".By day you'll find Joe coding web pages, tweaking for SEO, and leveraging social media to spread the word. By night you'll probably find him writing technology and "prepping" articles, as well as shooting video.Read more about Joe Levi here.