README.md
DrivePlay Keeper
My car has an annoying habit. Spotify keeps playing when I turn the engine off and leave the key in accessory mode, but it pauses as soon as I start the engine again. Android Auto never disconnects. The music just stops.
DrivePlay Keeper is the workaround I made for it. The app watches Spotify's Android media session and sends Play once after the unwanted pause.
How it behaves
The selected media app must be playing long enough for protection to arm. While Android Auto is connected, the next Pause is treated as the car's ignition pause and playback resumes after the configured delay. The app includes presets for Spotify and YouTube Music, and the timing controls are adjustable.
An intentional pause still works. Press Pause again within eight seconds and the app leaves it alone.
If another phone takes over the car connection, DrivePlay Keeper leaves this phone paused. Before it sends Play (at least 1.5 seconds after the pause), it checks that Android Auto is still connected and that the car's audio output is still present. Android Auto disconnecting, the car's Bluetooth or USB audio output disappearing, audio leaving the car, or car mode ending around the pause all cancel the resume. If one of those arrives within five seconds after an automatic resume, playback is paused again. These checks use Android's audio device and broadcast APIs and need no extra permissions. DrivePlay Keeper only reacts to a paused session, so a stopped session or the end of a playlist stays stopped.
Install it
DrivePlay Keeper requires Android 9 or newer.
- Download the APK from the latest release.
- Allow your browser or file manager to install unknown apps when Android asks.
- Install and open DrivePlay Keeper.
- Tap Grant notification access and enable DrivePlay Keeper media monitor.
- Leave Only act while Android Auto is connected enabled.
- Start Spotify through Android Auto and let it play for at least four seconds.
The live status section shows whether the app can see Android Auto and the selected media app, why protection did or did not fire, and a short decision history.
For reliable background operation, open the app's battery settings and select Unrestricted or Allow background usage. On phones with Sleeping or Deep sleeping app lists, make sure DrivePlay Keeper is not in either list. The media monitor is managed by Android and does not require a permanent notification.
Why it needs notification access
Android only lets approved notification listeners control another app's active
media session. DrivePlay Keeper uses that access to find the session belonging
to com.spotify.music and send Play.
The app does not read message content, collect data, or make network requests. There are no analytics or accounts.
Limits
Android Auto reports whether it is connected, but it does not expose the position of the ignition key. If the car's pause looks identical to a button press, DrivePlay Keeper may resume after the first intentional pause. Pressing Pause a second time within eight seconds overrides it.
The optional power-change setting is stricter. It only permits a resume after the phone starts or stops charging, which helps in cars that briefly interrupt USB power during startup. Some cars do not expose that change, so the setting is off by default.
Build it
Run the checks and create the APK on Windows:
| 1 | .\gradlew.bat testDebugUnitTest lintDebug packageDebugApk |
Gradle puts the finished APK in artifacts/. Android build intermediates go to
the system temporary directory to avoid OneDrive file-locking problems.
Release builds require the DrivePlay Keeper release keystore and the four
DRIVEPLAY_* signing environment variables. The build checks the signing
certificate against the release certificate introduced in 1.1.1 and refuses to
create a release APK if a different key is configured.
Version 1.1.1 is signed with a new release key. Android will not install it over an earlier version, so uninstall any existing DrivePlay Keeper install before installing 1.1.1. Settings will reset.
License
DrivePlay Keeper is available under the MIT License.