Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

phone call in Windows 10 UWP

Currently, I found Windows.ApplicationModel.Calls API. unable to make a call or launch different options available to make a call from my app. And also I try this Code but still can't implement the Phone call function, any solutions for UWP? Thank You.

if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.Calls.CallsPhoneContract", 1,0))
{
    PhoneCallManager.ShowPhoneCallUI("0213132131", "my name");
}
like image 381
Eng Soon Cheah Avatar asked Nov 27 '25 21:11

Eng Soon Cheah


2 Answers

I've come with a solution that is working on emulator, I cannot test it on actual device, cause I don't own one.

PhoneCallStore PhoneCallStore = await PhoneCallManager.RequestStoreAsync();
Guid LineGuid = await PhoneCallStore.GetDefaultLineAsync();

PhoneLine = await PhoneLine.FromIdAsync(LineGuid);
PhoneLine.Dial(phoneNumber, nameToBeDisplayed);

You have to add Windows Mobile Extentions for UWP to references of your project as well as declare PhoneCall capability in app manifest.

like image 175
miskohut Avatar answered Nov 29 '25 14:11

miskohut


The line,

PhoneCallManager.ShowPhoneCallUI("0213132131", "my name");

only shows the Call UI. It doesn't make a phone call.

You should use Windows.ApplicationModel.Calls.PhoneLine.Dial to make a phone call. See this for reference https://msdn.microsoft.com/en-us/library/windows.applicationmodel.calls.phoneline.aspx

See this example https://github.com/Microsoft/Windows-universal-samples/blob/master/Samples/PhoneCall/cs/Helpers/CallingInfo.cs#L85

like image 21
Raamakrishnan A. Avatar answered Nov 29 '25 15:11

Raamakrishnan A.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!