This Android app lets you long press the volume buttons to skip songs while the screen is off – WITHOUT Root!
If you’ve ever installed a custom ROM before, then there’s a good chance you’ve seen a feature that lets you remap a long press of the volume button to control media playback. With this option enabled, you can long press the volume up button to skip to the next track or long press the volume down button to return to the previous track. The ability to skip songs with volume button presses is so ubiquitous among custom ROMs that we’re surprised to see it hasn’t made its way into software from major OEMs.
We’ve covered ways to control music playback via the volume buttons using apps like Tasker or Button Mapper, but none of these apps replicate exactly what custom ROMs are able to offer. If you use Tasker or Button Mapper, you can only remap single or multi-presses of the volume up and down buttons. Apps like these either listen for changes in the media volume or use an Accessibility Service to intercept button presses from the volume keys, but neither solution is viable to intercept long-pressing of the volume keys when the screen is off.
Shortly after the release of Android 8.0 Oreo’s source code, I spotted a new Android feature that would allow an Android app to be set as the “volume key long press listener.” We speculated that this new API would allow apps to control the long-press volume button behavior when the screen is off, thus finally making it possible to replicate the popular custom ROM feature without needing root. Although the feature was implemented in AOSP, Google never added a user-facing way to set an app as a volume key long press listener. Like with Android’s hidden navigation bar customizer, this feature can still be used even without an implementation in the Settings app.
That’s exactly what XDA Member Cilenco did with the Skip Track by Volume Keys app. It’s an open source app that uses the hidden volume key long press listener API to let you change music tracks with a long press of either volume button even while the screen is off. It works on any Android 8.0 Oreo, Android 8.1 Oreo, Android 9 Pie, or Android Q device. The app was developed a few months after we published our article (the developer even cites the article as their inspiration for the app), but it was never shared on our forums until late last month when it was finally brought to our attention. We quickly took it for a spin to see if it worked—and it does! Here’s a hands-on video from XDA TV’s Max Weinbach:
adb shell pm grant com.cilenco.skiptrack android.permission.SET_VOLUME_KEY_LONG_PRESS_LISTENER
Then, enable the app’s Notification Listener service. This Notification Listener service doesn’t actually do anything, it’s just there to make sure the app doesn’t get killed in the background. On my Huawei Mate 20 X, I had to disable EMUI 9’s aggressive memory optimization feature, but after that I can confirm that it does work on EMUI. Since this is a hidden API, there’s no guarantee that Google won’t kill access to it in a future Android release. Since Android Pie, Google has been working on restricting undocumented/hidden APIs, so this may not work in the final release of Android Q or Android R.
Alternatively, if you would rather not install the APK from GitHub, you can try the newly updated release of Next Track (version 1.18) from XDA Recognized Developer flar2. He worked quickly to update this app after I informed him of this API, so go check that out if you want something a bit more customizable. Instructions on how to set it up can be found here. The developer is working on updating his Button Mapper app to use the new API, too. Button Mapper’s existing method to remap long presses of the volume button while the screen is off was a bit hackier and would reset on every reboot, but the new API persist across boots.