phone call in Windows 10 UWP

佐手、 提交于 2019-12-21 20:45:16

问题


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");
}

回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/33704341/phone-call-in-windows-10-uwp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!