Twilio - how to open activity when calling web to

2019-08-23 08:32发布

问题:

I have implemented the Twilio in my app and have made it so that web to web calls can be made and also web to phone calls. The only thing is that if I call Voice.call() with my user's phone number, it'll call him but the call will not open my activity on his device. The phone call UI will be the default decide's UI for incoming calls. If I, on the other hand, use the user's defined identity on his device, it'll go nicely via my activity. Any ideas on how I can make the web to phone call using a phone number and redirect the call via my activity?

I have been unable to find any documentation in this regard.

Cheers!

回答1:

Twilio developer evangelist here.

It's not the job of the Twilio SDK to intercept phone calls made directly to the device. However, since Android is flexible enough to replace the default phone application, you can do this yourself.

I am not an Android developer however, but a quick search around lead me to this tutorial on using a BroadcastReceiver to run your own code when an incoming phone call occurs. This StackOverflow answer might help you get started too.

Hope that helps.