5

In my app I need to play a loud sound as an emergency alarm. I'm trying this but I would like to produce something louder if possible (the loudest I could get).

AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
audioManager.setStreamVolume(AudioManager.STREAM_DTMF, audioManager.getStreamMaxVolume(AudioManager.STREAM_DTMF), AudioManager.FLAG_PLAY_SOUND);

ToneGenerator tone = new ToneGenerator(AudioManager.STREAM_DTMF, 100); // 100 is max volume
tone.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 500); // 500ms

Do you know how to produce the loudest sound?

Ferran Maylinch
  • 10,919
  • 16
  • 85
  • 100

0 Answers0