question

YoungCalabria-7310 avatar image
0 Votes"
YoungCalabria-7310 asked RobCaplan edited

Detect incoming VOIP calls in Android

Hi,

I need to detect incoming VOIP calls in order to allow/block some numbers.
I found CallScreeningService API for Android witch sounds good!
But I'm not sure and it is not clear whether it works only on gsm calls or it also supports voip too, for example like detecting whatsapp calls.

Any idea? Thanks!

dotnet-xamarin
· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

You can try to use AudioManager to detect incoming VOIP calls. Check the MODE_IN_COMMUNICATION, it could detect the incoming VOIP call. here is code snap.

AudioManager am = Application.Context.GetSystemService(Context.AudioService) as AudioManager;
             var mode = am.Mode;
            if (Mode.InCall == mode)
            {
                // device is in a telephony call
            }
            else if (Mode.InCommunication == mode)
            {
                // device is in communiation mode, i.e. in a VoIP or video call
            }
            else if (Mode.Ringtone == mode)
            {
                // device is in ringing mode, some incoming is being signalled
            }
            else
            {
                // device is in normal mode, no incoming and no audio being played
            }



0 Votes 0 ·

Thank you @LeonLu-MSFT.
But the problem is I want to detect incoming call event when app is running in the background.
I'm looking mainly to detect whatsapp calls in background and block them under specific criteria based on user preferences.
Is that achievable?

0 Votes 0 ·

You can have a try in BackgroundService.

0 Votes 0 ·
Show more comments

0 Answers