Reputation: 1134
I'm making VoIP app on Android, playing PCM audio like in Play PCM stream in Android
On my phone (LG V20, Android8) it works, but when I'm using volume buttons, it doesn't show Call volume and volume control doesn't work for my audio at all.
How to make my audio "Call audio" and be controlled by standard volume controls?
Upvotes: 0
Views: 349
Reputation: 1134
In the end, I was missing:
I'm surprised it wasn't in tutorials, maybe it was changed in later SDK.
Upvotes: 0
Reputation: 2716
You have to take AudioFocus by calling "requestAudioFocus()": https://developer.android.com/reference/android/media/AudioManager#requestAudioFocus(android.media.AudioFocusRequest) and set VOICECALL Stream in the Constructor of the Request.
Upvotes: 1