wolfgang ziegler


„make stuff and blog about it“

Calling a Number from your Windows Phone App

August 14, 2013

I am currently working on a Windows Phone app which allows the user to call a specific phone number directly from within “contact” page. The actual code to perform the phone boils down to just a few lines of code.

Code

var task = new PhoneCallTask();
task.PhoneNumber = "5551337";
task.Show();

We can even make this a snappy one-liner.

new PhoneCallTask { PhoneNumber = "5551337" }.Show();

Manifest

Additionally, you have to make sure that your app declares the necessary privileges in its manifest to be able to actually perform a phone call. For that, locate and open the WMAppManifest.xml file in your solution.

image

Then switch to the Capabilities tab and check the ID_CAP_PHONEDIALER option.

image


Action

That’s all. Following screenshots show the use of PhoneCallTask in action.

imageimage