A
A
Alexander Vasyuchenko2017-01-30 11:53:25
Android
Alexander Vasyuchenko, 2017-01-30 11:53:25

How to mute the sound in the smartphone when a warning message is played?

Tell me how to mute extraneous sounds in Android (music, movies in the background, etc.) when I need to play short sound warnings in my program?
Tried with AudioManager.requestAudioFocus with AUDIOFOCUS_GAIN_TRANSIENT and AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK flags. Does not help. The player in the background still plays music at the same volume.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
aol-nnov, 2017-01-30
@aol-nnov

I understand that the player must have OnAudioFocusChangeListener for this. if the player is a third party application, there is no guarantee that it is there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question