1

I have a Xamarin.Forms application that has a video chat feature. Currently, a video call is made by sending push notifications using Firebase, and is answered by touching the push notification. This is not a good solution, as a push notification may come too late, and it may be easily missed. I would like to use a native android telephony feature, that would let the user make a real phone ringing etc. I know it could be done using Telecom, as shown here:

https://developer.android.com/guide/topics/connectivity/telecom/selfManaged#incoming-calls

But I cannot figure out how practically I can integrate the telecom api with my application. E.g. should I keep push notification, and somehow make the incoming push notification get converted into a real phone call?

The article mentions for example,

onCreateIncomingConnection(PhoneAccountHandle, ConnectionRequest)

The telecom subsystem calls this method when your app calls the addNewIncomingCall(PhoneAccountHandle, Bundle) method to inform the system of a new incoming call in your app.

I don't see where this addNewIncomingCall() method is defined, or to what class it belongs.

Is there any example and/or explanation somewhere that would help me implement this?

David Shochet
  • 5,035
  • 11
  • 57
  • 105
  • 1
    every instance of `addNewIncomingCall` in that doc is linked to the API docs that show the method and it's parent class – Jason Jan 27 '22 at 19:02
  • @Jason I missed it, thank you for pointing out. The method belongs to TelecomManager. It is said, Apps do not instantiate this class directly; instead, they retrieve a reference to an instance through Context.getSystemService(Context.TELECOM_SERVICE). I found out I can get Context like this: Android.App.Application.Context; This does not compile, as Android is confused with the project name MyProj.Android, so App is not found in the namespace MyProj.Android. Could you tell how this is handled? Also, is it right that even with Telecom, I need push notification to make a call? – David Shochet Jan 27 '22 at 21:04
  • 2
    you could rename your project, or use `global::Android...` to reference the namespace – Jason Jan 27 '22 at 21:09
  • @Jason Thank you for your great help. While I am still working on applying Telecom, in meantime, if you make your comments an answer, I will mark it as such. – David Shochet Jan 28 '22 at 15:18

0 Answers0