How to play loud beep (beep) in Android

In my application, I need to play loud sound as an alarm. I try this, but I would like to make 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?

+4
source share

Source: https://habr.com/ru/post/1611857/


All Articles