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
13
votes
1 answer

Android: How to generate a frequency?

Is there a nice way in Android to generate and then play a frequency (eg. 1000hz, 245hz)?
Flynn
  • 5,903
  • 7
  • 38
  • 55
13
votes
2 answers

Increase volume of recording Android AudioRecord

I'm using AudioRecord and lame to record mic input to a mp3 sample for 12 seconds. The audio is recorder as expected but I realized the volume is too low. Is there a way to increase the volume of the recording?
Wedava
  • 1,211
  • 2
  • 16
  • 30
13
votes
1 answer

How to pass a parameter to a subclass of BroadcastReceiver?

I managed to get my headset buttons get recognized by my app when pressed, but one of the buttons needs to call a method that's in MyCustomActivity. The problem is onReceive's 1st parameter is a Context that cannot be cast to Activity and using a…
an00b
  • 11,338
  • 13
  • 64
  • 101
12
votes
3 answers

Android SDK. audioManager. setStreamVolume max int value

I'm in the process of developing an Android app. I have been able to successfully set the speaker volume using: AudioManager audioManager =…
Marc Brown
  • 601
  • 2
  • 11
  • 26
12
votes
2 answers

What is audio focus in Android class AudioManager?

The AudioManager class has a method abandonAudioFocus() and another method requestAudioFocus(). I wonder what is audio focus? And what happens if an AudioManager object gets the audio focus or lost the audio focus? Thank you!
Chris.Zou
  • 4,506
  • 6
  • 31
  • 38
12
votes
1 answer

Android link headphone volume to master volume

I have an android TV (Philips 49PUS6401) I want to connect a surround sound system to it which is much better quality than the built in speakers even when only being used in stereo. however this TV separates the volume control for the master output…
James Kent
  • 5,763
  • 26
  • 50
12
votes
2 answers

Alternative for deprecated AudioManger.setStreamMute?

AudioManger.setStreamMute is now deprecated with api 23 and it is preferred to use AudioManager.adjustStreamVolume with AudioManager.ADJUST_MUTE. My problem is that this kind of flag is only supported with api 23 while my app is minimum api 16. Is…
12
votes
1 answer

Audio track not working through Bluetooth in Samsung S6

I am recording audio using AudioRecord and playing using AudioTrack. I am recording Fm analog audio stream using this classes and simultaneously passing into Bluetooth router. Its successfully working with Motorola and Samsung S5. But not working…
12
votes
6 answers

How to get current ringtone in Android?

I have found lots of examples how to get default ringtone. Something like that: Uri alert = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE); Ringtone ringtone = RingtoneManager.getRingtone(getApplicationContext(), alert); …
chabislav
  • 939
  • 1
  • 8
  • 27
12
votes
2 answers

What triggers (or generates) KeyEvent.ACTION_MULTIPLE?

The documentation for KeyEvent.ACTION_MULTIPLE says: "multiple duplicate key events have occurred in a row, or a complex string is being delivered. If the key code is not {#link KEYCODE_UNKNOWN then the {#link getRepeatCount() method returns…
ih8ie8
  • 944
  • 8
  • 23
12
votes
2 answers

How to play or resume music of another music player from my code

In my Android app I want to play or resume the played music after I pause it. I got my app to pause the music by sending a broadcast, but I can't get it to play or resume the music. Here is the code to pause: Intent i = new…
iboalali
  • 379
  • 1
  • 5
  • 13
11
votes
1 answer

isSpeakerphoneOn stopped working on Android 11 devices

Been struggling with the audio manager after the latest Android 11 rollout to Samsungs. It has been working smoothly for several years now including all possible Android 10 devices and below. Here is how we get the audio manager: val audioManager =…
11
votes
0 answers

Programmatically show volume dialog for all streams and keep it up

By using this AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_SAME, AudioManager.FLAG_SHOW_UI); I can display the…
Beppi's
  • 2,089
  • 1
  • 21
  • 38
11
votes
3 answers

Android SoundPool doesn't play same sound for second time until playing another sound

Here is my Activity: public class MainActivity extends AppCompatActivity { private SoundPool soundPool; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); …
Misagh Emamverdi
  • 3,654
  • 5
  • 33
  • 57
11
votes
2 answers

Using AudioManager interferes with call audio

I'm using the following code in a BroadcastReceiver (phone state listener) to enable speakerphone: final Handler mHandler = new Handler(); mHandler.postDelayed(new Runnable() { @Override public void run() { AudioManager audioManager…
JstnPwll
  • 8,585
  • 2
  • 33
  • 56
1 2
3
52 53