I have created a Xamarin Forms app and I need to programatically close a call. I have searched for a solution to this seemingly simple problem but can't find anything. Could someone please help. If you require further information, please let me know and I will provide it. Not sure if this is enough info. Thank you. I have placed the code below:
public bool CallInProgress()
{
var telephonyManagerService = (TelephonyManager)Xamarin.Forms.Forms.Context.GetSystemService(Context.TelephonyService);
var getCurrentState = telephonyManagerService?.CallState;
if (getCurrentState.ToString().ToUpper() == CallState.Idle.ToString().ToUpper())
{
return false;
}
else
{
return true;
}
}
public void EndCurrentCall()
{
if (CallInProgress())
{
//Need the code here to end the current call
}
}