简体   繁体   English

在Windows Phone 8.1中拨打电话

[英]Make a phone call in Windows Phone 8.1

I'm writing a Universal App for Windows 8.1 / Windows Phone 8.1 that at some point displays a list of phone numbers. 我正在为Windows 8.1 / Windows Phone 8.1编写一个通用应用程序,在某些时候会显示一个电话号码列表。 What I would like to do is allow the user to press one of these numbers and have the device call (or ask permission to call) that number if running on Windows Phone 8.1. 我想要做的是允许用户按下这些号码中的一个并在Windows Phone 8.1上运行时让设备呼叫(或请求允许呼叫)该号码。 I know this was previously possible in Windows Phone 8 by doing the following: 我知道以前在Windows Phone 8中可以执行以下操作:

using Microsoft.Phone.Tasks;

PhoneCallTask phoneCallTask = new PhoneCallTask();

phoneCallTask.PhoneNumber = "2065550123";
phoneCallTask.DisplayName = "Gage";

phoneCallTask.Show();

NOTE: This code is wrapped in #if WINDOWS_PHONE_APP 注意:此代码包含在#if WINDOWS_PHONE_APP中

However, when trying to import Microsoft.Phone.Tasks , Visual Studio is unable to find the reference. 但是,在尝试导入Microsoft.Phone.Tasks ,Visual Studio无法找到该引用。 I know that " ID_CAP_PHONEDIALER " had to be enabled in WMAppManifest.xml in Windows Phone 8, but this doesn't seem to be possible with the universal app model. 我知道必须在Windows Phone 8中的WMAppManifest.xml中启用“ ID_CAP_PHONEDIALER ”,但通用应用程序模型似乎无法实现这一点。 I've been searching around for a solution but can't find a recent one that includes Windows Phone 8.1 (not Silverlight). 我一直在寻找解决方案,但找不到最新的包含Windows Phone 8.1(不是Silverlight)的解决方案。

Is there any way to make a phone call from within a universal app? 有通过通用应用程序拨打电话的方法吗? Or is it simply not possible at the moment? 或者目前根本不可能?

In Windows Phone 8.1, We can make phone call by "Windows.ApplicationModel.Calls.PhoneCallManager" , just like this: 在Windows Phone 8.1中,我们可以通过“Windows.ApplicationModel.Calls.PhoneCallManager”拨打电话,如下所示:

Windows.ApplicationModel
.Calls.PhoneCallManager
.ShowPhoneCallUI("phone number", "display name");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM