最終更新:2021-11-04 (木) 14:04:56 (28d)  

android.media.AudioManager
Top / android.media.AudioManager

AudioManager provides access to volume and ringer mode control.

http://developer.android.com/reference/android/media/AudioManager.html

Use Hardware Volume Keys to Control Your App’s Audio Volume

メソッド

Bluetooth

メモ

  • if ( Build.VERSION.SDK_INT >= 23 ) {
    	am.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_UNMUTE, 0);
    }else {
    	am.setStreamMute(AudioManager.STREAM_MUSIC, true);
    }

Android/音声ストリーム

  • AudioManager.STREAM_VOICE_CALL?0通話音量
    AudioManager.STREAM_SYSTEM?1システムメッセージ音量
    AudioManager.STREAM_RING?2着信音量
    AudioManager.STREAM_MUSIC3音楽再生音量
    AudioManager.STREAM_ALARM?4アラーム音量
    AudioManager.STREAM_NOTIFICATION?5通知音量
    AudioManager.STREAM_DTMF?8ダイヤル音量

フラグ

  • AudioManager.FLAG_SHOW_UI1Show a toast containing the current volume.
    AudioManager.FLAG_ALLOW_RINGER_MODES?2Whether to include ringer modes as possible options when changing volume.
    AudioManager.FLAG_PLAY_SOUND4Whether to play a sound when changing the volume
    AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE?8Removes any sounds/vibrate that may be in the queue, or are playing (related to changing volume).
    AudioManager.FLAG_VIBRATE?16Whether to vibrate if going into the vibrate ringer mode.
    AudioManager.FLAG_FIXED_VOLUME?1 << 5@hide
    AudioManager.FLAG_BLUETOOTH_ABS_VOLUME?1 << 6@hide
    AudioManager.FLAG_SHOW_SILENT_HINT?1 << 7@hide
    AudioManager.FLAG_HDMI_SYSTEM_AUDIO_VOLUME?1 << 8@hide
    AudioManager.FLAG_ACTIVE_MEDIA_ONLY?1 << 9@hide
    AudioManager.FLAG_SHOW_UI_WARNINGS?1 << 10@hide
    AudioManager.FLAG_SHOW_VIBRATE_HINT?1 << 11@hide
    AudioManager.FLAG_FROM_KEY?1 << 12@hide

direction

  • AudioManager.ADJUST_LOWER?-1
    AudioManager.ADJUST_RAISE?1
    AudioManager.ADJUST_SAME?0
    AudioManager.ADJUST_TOGGLE_MUTE?101
    AudioManager.ADJUST_MUTE-100
    AudioManager.ADJUST_UNMUTE?100

モード

  • AudioManager.RINGER_MODE_SILENT?0
    AudioManager.RINGER_MODE_VIBRATE?1
    AudioManager.RINGER_MODE_NORMAL?2

ブロードキャスト

  • AudioManager.ACTION_AUDIO_BECOMING_NOISY?Broadcast intent, a hint for applications that audio is about to become 'noisy' due to a change in audio outputs.
    AudioManager.ACTION_HDMI_AUDIO_PLUG?Broadcast Action: A sticky broadcast indicating an HDMI cable was plugged or unplugged.
    AudioManager.ACTION_HEADSET_PLUG?Broadcast Action: Wired Headset plugged in or unplugged.
    AudioManager.ACTION_MICROPHONE_MUTE_CHANGED?Broadcast Action: microphone muting state changed.
    AudioManager.ACTION_SCO_AUDIO_STATE_CHANGED?This constant was deprecated in API level 15. Use ACTION_SCO_AUDIO_STATE_UPDATED instead
    AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED?Sticky broadcast intent action indicating that the Bluetooth SCO audio connection state has been updated.
    AudioManager.ACTION_SPEAKERPHONE_STATE_CHANGED?Broadcast Action: speakerphone state changed.

関連