I'm developing a VoIP application (in java) and need to suspend an ongoing native GSM call when the user answers an incoming VoIP call (similar to WhatsApp's behavior). However, my app is not set as the default dialer.
Is this functionality supported on the latest Android versions? If so, what APIs or methods can be used to achieve this? Any insights or guidance would be greatly appreciated!
so far i've tried:
using inCallService, seems to require system level permission
getting exclusive AUDIOFOCUS like this:
int result = audioManager.requestAudioFocus(focusRequest);
if (result == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
// Audio focus successfully acquired.
// Native call audio should be interrupted or ducked.
}
always got me only AUDIOFOCUS_REQUEST_DELAYED