Control Music Playback Using Hardware Buttons on Android

Ashish Mundhra

If you have been following my articles, you must be aware about how biased I am towards Android when compared to the iPhone. I would always prefer Android as my default smartphone over the iPhone any day. But today, I am favoring the iPhone and that is because of its compatibility towards different headsets we have in the market.

earphones android hardware button
Let’s Make listening to Music on Android Better Today | Shutterstock

The default EarPods that comes with the phone have hardware keys using which you can not only answer calls, but also control music playback. It even accepts compatible earphones with hardware buttons, making it easy to shuffle songs without taking the phone out of the pockets.

music earphones
Your Earphones Are All What You Need | Shutterstock

However, when it comes to Android, there are different OEMs and manufactures and most of them don’t have a feature to use headphone buttons to shuffle songs. And the ones which have the feature, limit it to stock headphones and are hardly compatible with any other headphones. But it’s Android we are talking about and from my experience, I know there’s always a solution.

For the problem in hand, the name of the solution is Physical Button Music Control (PBMC). PBMC is an Xposed Module that can be installed on rooted Android phones with the Xposed framework pre-installed.

download PBMC

PBMC is not a plug-and-play app and needs configuration before you can use it. But the great part is, that the app can be fully customized as per your needs. So let’s see how the app works once we have installed and activated it in the Xposed app.

Note: The app was tested on a Sony Xperia Z (Android 4.4.4) with Xposed framework. Two headphones tested were the Motorola headphones (with just one button) and Monster DLNA (three buttons) and it worked all the time. There were no compatibility issues.

Configuring Physical Button Music Control (PBMC)

After you open the app, tap on Add Mapping to map a hardware key with a set of actions. After you tap on the option, the app will detect any hardware key press and once you confirm, it will add it as a mapping. If you wish to configure your headphone keys, plug it in and press the key there. Just make sure you don’t select power button. It doesn’t make any sense, trust me.

PBMC (2)  PBMC (3)

Now, under the current key mapping, tap on each of the button name and you will see a list of actions you can perform on these buttons. The actions can be single press, double press, press and hold. Tap of any of these actions you would like to use and make the selection of your choice. Just remember that you don’t change obvious actions like the volume button. The first priority must always be increasing or decreasing the volume.

PBMC (5)  select action

You can add a mapping for each of the hardware button you have on your phone and headphones, just remember the task assigned to each of them. If you dig deeper, you can even launch and shoot a photo from your camera. It’s there if you look for it. But if you give up, just comment and we will assist.

Selecting the Default Media Player for Actions

The next great thing about the app is that it works on all the media player apps, even the ones that stream music like Spotify and Saavn. Tap on Settings and select Signal Receiver and then tap on the app on which you play your music. The app scans for all the apps that have the ability to playback media on your device and sends the signal to the particular Android activity.

PBMC (6)  PBMC (1)

The easiest way here would be to play songs on your default player and select the option Use last used media player.

Conclusion

That was how you can control media playback on your Android using the hardware buttons of any headphones. If you use a Bluetooth earphone with no buttons, you can use the hardware buttons on the phone. The one thing about the app I like is that even if you have one button on your earphones (like the ones provided by Motorola) you can assign up to 7 actions to it which is more than enough for anyone.

Try out the app, whether if you are a music buff or not, I am sure you will like it. Just imagine skipping songs right from a single button you have on your earphone. Priceless!

Also See
#Android apps#music

Join the newsletter

Ashish Mundhra

Written By

Ashish Mundhra

Ashish is a staff writer and video editor at Guiding Tech. He loves all things tech and has a soft corner for Android. Apart from contributing articles here, he also takes care of our YouTube Channel.