使的Windows Phone 8.1的电话 [英] Make a phone call in Windows Phone 8.1

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

问题描述

我正在写一个通用的应用程序为Windows 8.1 / Windows Phone的8.1,在某些时候显示的电话号码列表。我想这样做是允许用户按一个号码,并有设备呼叫(或问权限调用)的号码,如果在Windows Phone 8.1上运行。我知道这是以前可能在Windows Phone 8的通过执行以下操作:

I'm writing a Universal App for Windows 8.1 / Windows Phone 8.1 that at some point displays a list of phone numbers. 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. I know this was previously possible in Windows Phone 8 by doing the following:

using Microsoft.Phone.Tasks;

PhoneCallTask phoneCallTask = new PhoneCallTask();

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

phoneCallTask.Show();

注意:此代码是包裹在#if WINDOWS_PHONE_APP

但是,试图导入 Microsoft.P​​hone.Tasks 时,Visual Studio是无法找到的参考。我知道, ID_CAP_PHONEDIALER 不得不在WMAppManifest.xml在Windows Phone 8的启用,但是这似乎并不可能与通用应用模型。我一直在寻找周围的解决方案,但无法找到最近的一个,其中包括的Windows Phone 8.1(不是Silverlight的)。

However, when trying to import Microsoft.Phone.Tasks, Visual Studio is unable to find the reference. 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. I've been searching around for a solution but can't find a recent one that includes Windows Phone 8.1 (not Silverlight).

有没有什么办法让手机从通用的应用程序中调用?或在此刻是根本不可能的?

Is there any way to make a phone call from within a universal app? Or is it simply not possible at the moment?

推荐答案

在的Windows Phone 8.1,我们可以通过拨打电话 Windows.ApplicationModel.Calls.PhoneCallManager,就像这样:

In Windows Phone 8.1, We can make phone call by "Windows.ApplicationModel.Calls.PhoneCallManager", just like this:

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

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

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