CarAudioManager.CarVolumeCallback

public static abstract class CarAudioManager.CarVolumeCallback
extends Object

java.lang.Object
   ↳ android.car.media.CarAudioManager.CarVolumeCallback


Callback interface to receive volume change events in a car. Extend this class and register it with CarAudioManager.registerCarVolumeCallback(android.car.media.CarAudioManager.CarVolumeCallback) and unregister it via CarAudioManager.unregisterCarVolumeCallback(android.car.media.CarAudioManager.CarVolumeCallback)

Summary

Public constructors

CarVolumeCallback()

Public methods

void onGroupMuteChanged(int zoneId, int groupId, int flags)

This is called whenever a group mute state is changed.

void onGroupVolumeChanged(int zoneId, int groupId, int flags)

This is called whenever a group volume is changed.

void onMasterMuteChanged(int zoneId, int flags)

This is called whenever the global mute state is changed.

Inherited methods

Public constructors

CarVolumeCallback

public CarVolumeCallback ()

Public methods

onGroupMuteChanged

Added in API level 31
public void onGroupMuteChanged (int zoneId, 
                int groupId, 
                int flags)

This is called whenever a group mute state is changed. The changed-to mute state is not included, the caller is encouraged to get the current group mute state via CarAudioManager.

Notes:

Parameters
zoneId int: Id of the audio zone that volume change happens

groupId int: Id of the volume group that volume is changed

flags int: see AudioManager for flag definitions

onGroupVolumeChanged

Added in API level 29
public void onGroupVolumeChanged (int zoneId, 
                int groupId, 
                int flags)

This is called whenever a group volume is changed. The changed-to volume index is not included, the caller is encouraged to get the current group volume index via CarAudioManager.

Notes:

  • If both CarVolumeCallback and CarVolumeGroupEventCallback are registered by the same app, then volume group index changes are only propagated through CarVolumeGroupEventCallback (until it is unregistered)
  • Apps are encouraged to migrate to the new callback CarVolumeGroupEventCallback

Parameters
zoneId int: Id of the audio zone that volume change happens

groupId int: Id of the volume group that volume is changed

flags int: see AudioManager for flag definitions

onMasterMuteChanged

Added in API level 29
public void onMasterMuteChanged (int zoneId, 
                int flags)

This is called whenever the global mute state is changed. The changed-to global mute state is not included, the caller is encouraged to get the current global mute state via AudioManager.

Note: If CarAudioManager#AUDIO_FEATURE_VOLUME_GROUP_MUTING is disabled this will be triggered on mute changes. Otherwise, car audio mute changes will trigger onGroupMuteChanged(int, int, int)

Parameters
zoneId int: Id of the audio zone that global mute state change happens

flags int: see AudioManager for flag definitions