Changing the volume using Audiomanager (as suggested here: https://github.com/spotify/android-sdk/issues/201) does not seem to work consistently.
Developing an alarm clock that starts a Spotify playlist on muted (or very low) volume and progressively increases the volume.
Sometimes Spotifiy keeps playing muted, sometimes Spotify changes the volume back after every time it is changed by the Audiomanager. It appears Spotify takes the initial volume and resets it every time back to this value.
Issue found on 2024-02-25.
SDK Version: 34
OS Version: Android 13/14
Register an alarm (using AlarmManager.setAlarmClock or setExact)
In the BroadcastReceiver:
Use Audiomanager.setStreamVolume to mute the volume
Connect to Spotify with AppRemote and start playing (e.g. a playlist)
Start a Task the increases the volume at a fixed rate (using ScheduledThreadPoolExecutor)
I have only been able to reproduce the problem when starting Spotify by an alarm on a real phone.
When starting it directly (e.g. in MainActivity), or when testing in a simulator, it appears to work correctly.
Expected behaviour:
The volume gets increased by the Task and Spotify adheres to the volume set in the Audiomanager (does not overwrite it)
Actual behaviour:
Sometimes it works, sometimes the volume keeps muted, sometimes it resets the volume after each change
Changing the volume using Audiomanager (as suggested here: https://github.com/spotify/android-sdk/issues/201) does not seem to work consistently. Developing an alarm clock that starts a Spotify playlist on muted (or very low) volume and progressively increases the volume. Sometimes Spotifiy keeps playing muted, sometimes Spotify changes the volume back after every time it is changed by the Audiomanager. It appears Spotify takes the initial volume and resets it every time back to this value.
Issue found on 2024-02-25.
SDK Version: 34
OS Version: Android 13/14
I have only been able to reproduce the problem when starting Spotify by an alarm on a real phone. When starting it directly (e.g. in MainActivity), or when testing in a simulator, it appears to work correctly.
Expected behaviour:
The volume gets increased by the Task and Spotify adheres to the volume set in the Audiomanager (does not overwrite it)
Actual behaviour:
Sometimes it works, sometimes the volume keeps muted, sometimes it resets the volume after each change