AudioManager allows your application to control the phone’s media volume either by pressing the hardware volume buttons on the phone or programmatically.

Setting Maximum Vloume

// OR

// OR

The last parameter in setStreamVolume(), denotes flags. These control how the user is indicated of the volume change.
FLAG_PLAY_SOUND – play a system beep to indicate the volume

FLAG_SHOW_UI     – displays a toast notifying the user that the media volume has been changed
FLAG_VIBRATE     – vibrates your phone.

mAudioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE,

AudioManager.FLAG_SHOW_UI);

ADJUST_LOWER     Decreases the volume.
ADJUST_RAISE     Increases the ringer volume.
ADJUST_SAME    Maintains same Volume

 

Reference:

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

Incoming search terms:

  • playsoundeffect(audiomanager flag_play_sound) android

Tagged with:

Filed under: Android

Like this post? Subscribe to my RSS feed and get loads more!