Home » c# » Make a phone call in Windows Phone 8.1

Make a phone call in Windows Phone 8.1

Posted by: admin February 22, 2018 Leave a comment

Questions:

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

NOTE: This code is wrapped in #if WINDOWS_PHONE_APP

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?

Answers:

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