Questions tagged [android-audiomanager]

AudioManager provides access to volume and ringer mode control.

AudioManager provides access to volume and ringer mode control.

AudioManager Class Reference

792 questions
56
votes
8 answers

In Android 7 (API level 24) my app is not allowed to mute phone (set ringer mode to silent)

I have an app that mutes the phone by using AudioManager and setting ringer mode to silent with this code: AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); try { …
Bjarte Aune Olsen
  • 3,230
  • 4
  • 24
  • 36
55
votes
5 answers

Change Media volume in Android?

Can I change the media volume? and how? I used this so far: setVolumeControlStream(AudioManager.STREAM_MUSIC); But have a seekbar and want to change the media volume, not ring volume. So can someone show me how to just change the media volume at…
carefacerz
  • 1,287
  • 3
  • 16
  • 27
53
votes
8 answers

How do you get/set media volume (not ringtone volume) in Android?

Is there a way to get/set media volume? I have tried the following: AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE); int currentVolume = audio.getStreamVolume(AudioManager.STREAM_RING); but it returns the ringtone…
Buda Gavril
  • 21,409
  • 40
  • 127
  • 196
42
votes
9 answers

Not able to achieve Gapless audio looping so far on Android

I have tried almost every method but I've failed to achieve gapless audio playback between looping a single track with a duration of 10-15 seconds. Steps I've tried and failed : Different audio file formats .mp3 .wav .ogg…
Sai
  • 15,188
  • 20
  • 81
  • 121
42
votes
7 answers

Using SeekBar to Control Volume in android?

How can I accurately change the volume of my app using a seekbar without controlling the volume by the volume buttons on my android device? I have seperate function on the Volume keys on my android that's why I want to use a seekbar to control the…
Niel Prince
  • 475
  • 1
  • 5
  • 9
40
votes
2 answers

Transfer data through audio jack cable over two Android devices

I'm researching on transferring text data over male-to-male audio jack cable. I'm testing this on HTC one V and on PC, which supports male-to-male audio jack for data transfer as mentioned in this Wikipedia article. It says: The first, which places…
32
votes
3 answers

How does setMicrophoneMute() work?

I have been trying to use Android's AudioManager.setMicrophoneMute() without much success. That is, it simply refuses to mute the microphone, no matter what I do. I searched the web for some clues and I found several references reporting similar…
ateiob
  • 9,016
  • 10
  • 44
  • 55
32
votes
2 answers

How to detect when a user plugs headset on android device? (Opposite of ACTION_AUDIO_BECOMING_NOISY)

I'm developing an application that has the following requisite: If there is a headset plugged in the device and the user removes it, I need to mute all streams. To do that I need to listen to the AudioManager.ACTION_AUDIO_BECOMING_NOISY Broadcast.…
Renato Lochetti
  • 4,558
  • 3
  • 32
  • 49
24
votes
1 answer

stream volume in SoundPool vs volume in AudioManager

I am so confused... SoundPool.play(int soundID, float leftVolume, float rightVolume, int priority, int loop, float rate) volume here is from 0.0 to 1.0 Tutorials I've seen recommend to calculate stream volume as: AudioManager mgr = (AudioManager)…
mishkin
  • 5,932
  • 8
  • 45
  • 64
24
votes
8 answers

How to increase and decrease the volume programmatically in Android

I created a music player app and I want to set the volume up/down programmatically. I want to implement two Buttons to increase/decrease the volume and set to the media player. Activity: control = (ImageView) findViewById(R.id.control); mediaPlayer…
Udhaya
  • 309
  • 1
  • 3
  • 9
22
votes
1 answer

How to provide customized vibration on specific incoming calls

The program functions like this: the user has a list of phone numbers, for which the cellphone could vibrate upon an incoming call only when no other system-wide application would provide vibration (such as in mute mode). I know that this is…
peter
  • 1,034
  • 1
  • 9
  • 23
21
votes
8 answers

Android Context Memory Leak ListView due to AudioManager

I have a ListView and I would expect it to be cleared from memory when the activity finishes. However, it appears that it is leaking. When I check the Memory Dump, and get the pathToGC for the ListView I get the following, Class Name …
Leo
  • 4,652
  • 6
  • 32
  • 42
21
votes
2 answers

How to turn on speaker for incoming call programmatically in Android L?

I want to accept an incoming call using answering phone's GUI (Phone's GUI) of my phone in Android 5.0. I found a way that needs to make an activity which use to send some action to open the Phone's GUI. I was successful to turn on the Phone's GUI…
Jame
  • 3,746
  • 6
  • 52
  • 101
21
votes
1 answer

What is the android api for getting the list of connected audio devices?

I used the below added code to get the connected audio devices for android device. Used AudioManager api method getDevices() and got the result with connected devices like earphones, speaker, headphones. But this getDevices() method is available…
21
votes
2 answers

How to Play audio through speaker even when headset is plugged in?

The title of the question might look repeated, but my problem is a sometimes problem and causes glitches. I have used the below code to play through speaker when headset is plugged in. AudioManager audioManager =…
crazy_coder
  • 1,039
  • 2
  • 8
  • 18
1
2 3
52 53