Windows 10 UWP 中的电话 [英] phone call in Windows 10 UWP

查看:28
本文介绍了Windows 10 UWP 中的电话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我找到了 Windows.ApplicationModel.Calls API.无法拨打电话或启动不同的选项以从我的应用程序拨打电话.而且我也尝试了这个代码,但仍然无法实现电话呼叫功能,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");
}

推荐答案

我提供了一个在模拟器上运行的解决方案,我无法在实际设备上测试它,因为我没有.

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

您必须将 Windows Mobile Extentions for UWP 添加到您的项目引用中,并在应用清单中声明 PhoneCall 功能.

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

这篇关于Windows 10 UWP 中的电话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆