pub enum Usage {
Show 16 variants
Media = 1,
VoiceCommunication = 2,
VoiceCommunicationSignalling = 3,
Alarm = 4,
Notification = 5,
NotificationRingtone = 6,
NotificationEvent = 10,
AssistanceAccessibility = 11,
AssistanceNavigationGuidance = 12,
AssistanceSonification = 13,
Game = 14,
Assistant = 16,
Emergency = 1_000,
Safety = 1_001,
VehicleStatus = 1_002,
Announcement = 1_003,
}Expand description
The Usage attribute expresses “why” you are playing a sound, what is this sound used for. This information is used by certain platforms or routing policies to make more refined volume or routing decisions.
Note that these match the equivalent values in android.media.AudioAttributes in the Android Java API.
Added in API level 28.
Variants§
Media = 1
Use this for streaming media, music performance, video, podcasts, etcetera.
VoiceCommunication = 2
Use this for voice over IP, telephony, etcetera.
VoiceCommunicationSignalling = 3
Use this for sounds associated with telephony such as busy tones, DTMF, etcetera.
Alarm = 4
Use this to demand the users attention.
Notification = 5
Use this for notifying the user when a message has arrived or some other background event has occured.
NotificationRingtone = 6
Use this when the phone rings.
NotificationEvent = 10
Use this to attract the users attention when, for example, the battery is low.
AssistanceAccessibility = 11
Use this for screen readers, etcetera.
Use this for driving or navigation directions.
AssistanceSonification = 13
Use this for user interface sounds, beeps, etcetera.
Game = 14
Use this for game audio and sound effects.
Assistant = 16
Use this for audio responses to user queries, audio instructions or help utterances.
Emergency = 1_000
Use this in case of playing sounds in an emergency. Privileged MODIFY_AUDIO_ROUTING permission required.
Safety = 1_001
Use this for safety sounds and alerts, for example backup camera obstacle detection. Privileged MODIFY_AUDIO_ROUTING permission required.
VehicleStatus = 1_002
Use this for vehicle status alerts and information, for example the check engine light. Privileged MODIFY_AUDIO_ROUTING permission required.
Announcement = 1_003
Use this for traffic announcements, etc. Privileged MODIFY_AUDIO_ROUTING permission required.