java.lang.Object | |
↳ | android.media.VolumeProvider |
Handles requests to adjust or set the volume on a session. This is also used
to push volume updates back to the session. The provider must call
setCurrentVolume(int)
each time the volume being provided changes.
You can set a volume provider on a session by calling
setPlaybackToRemote(VolumeProvider)
.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | VOLUME_CONTROL_ABSOLUTE | The volume control uses an absolute value. | |||||||||
int | VOLUME_CONTROL_FIXED | The volume is fixed and can not be modified. | |||||||||
int | VOLUME_CONTROL_RELATIVE |
The volume control uses relative adjustment via
onAdjustVolume(int) .
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a new volume provider for handling volume events.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Gets the current volume.
| |||||||||||
Get the maximum volume this provider allows.
| |||||||||||
Get the volume control type that this volume provider uses.
| |||||||||||
Override to handle requests to adjust the volume of the current output.
| |||||||||||
Override to handle requests to set the volume of the current output.
| |||||||||||
Notify the system that the current volume has been changed.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
The volume control uses an absolute value. It may be adjusted using
onAdjustVolume(int)
or set directly using
onSetVolumeTo(int)
.
The volume is fixed and can not be modified. Requests to change volume should be ignored.
The volume control uses relative adjustment via
onAdjustVolume(int)
. Attempts to set the volume to a specific
value should be ignored.
Create a new volume provider for handling volume events. You must specify the type of volume control, the maximum volume that can be used, and the current volume on the output.
volumeControl | The method for controlling volume that is used by this provider. |
---|---|
maxVolume | The maximum allowed volume. |
currentVolume | The current volume on the output. |
Gets the current volume. This will be the last value set by
setCurrentVolume(int)
.
Get the maximum volume this provider allows.
Get the volume control type that this volume provider uses.
Override to handle requests to adjust the volume of the current output.
Direction will be one of ADJUST_LOWER
,
ADJUST_RAISE
, ADJUST_SAME
.
After the volume has been modified setCurrentVolume(int)
must be
called to notify the system.
direction | The direction to change the volume in. |
---|
Override to handle requests to set the volume of the current output.
After the volume has been modified setCurrentVolume(int)
must be
called to notify the system.
volume | The volume to set the output to. |
---|
Notify the system that the current volume has been changed. This must be called every time the volume changes to ensure it is displayed properly.
currentVolume | The current volume on the output. |
---|