Skip to content Skip to sidebar Skip to footer

Onadjustvolume Not Called

I am trying to get HARDWARE_HOOK button and volume change button in my service using MediaSession for Android 5.0+ . This has to work specially when screen is off/locked. The probl

Solution 1:

onAdjustVolume and VolumeProviderCompat are desired to work with remote displays, when you play some music/video using casting. method won't fire when you are using on-device buttons during e.g. silence and screen-off. confusing class name, its not so universal as it sounds...

afaik at the beginning of 2021 there is no reliable way for intercepting volume button presses when screen off, probably even detecting... (@op if you found solution please post)

The reason is probably that this is one of intended "features" of Android for reducing battery draining during screen off - distributing button presses straight to lower audio-managing layers ommiting framework/apps, not allowing to execute some additional code (which we want to do)

Post a Comment for "Onadjustvolume Not Called"