You might already know that, Windows Phone 8.1 SDK came with few API changes targeting the Windows Runtime. If you are a developer and looking to launch the phone dialler from your app, this post will help you to know the changes.
In this post we are going to discuss “How to programmatically do a Phone Call in Windows Phone 8.1” with a comparison between the API changes.
You might already know that, many APIs have been changed in Windows Phone 8.1 if you compare them with it’s previous version (i.e. WP8). I have already blogged few of them. You can read them here:
- Windows Phone 8.1 Screen Orientation - What’s changed for #WPDev?
- Windows Phone 8.1 Ratings & Review - What’s changed for #WPDev?
- Windows Phone 8.1 TTS Voice API - What’s changed for #WPDev?
- Windows Phone 8.1 Text-To-Speech - What’s changed for #WPDev?
- Windows Phone 8.1 Status Bar - What’s changed for #WPDev?
- Windows Phone 8.1 TextBox Control - What’s new for #WPDev?
How to create a Phone Call in Windows Phone 8.0 or earlier?
Earlier to Windows Phone 8.1, I mean in Windows Phone (Silverlight) applications, we had to call the PhoneCallTask API. It’s a sealed class present in “Microsoft.Phone.Tasks” namespace and exposes two properties named “DisplayName”, “PhoneNumber”. It also exposes a method named “Show”, when called, launches the PhoneCallTask and dials the specified number.
var phoneCallTask = new PhoneCallTask
DisplayName = "Kunal Chowdhury",
PhoneNumber = "9876543210"
How to create a Phone Call in Windows Phone 8.1?
If you are building Windows Phone 8.1 universal app, this has been changed a bit. You will not find the PhoneCallTask now. Rather, Microsoft exposed a new API that launches the built-in phone call UI with the specified phone number and display name. “PhoneCallManager” is a new static class placed in “Windows.ApplicationModel.Calls” namespace provides a static method named “ShowPhoneCallUI” and takes two string parameters called PhoneNumber and DisplayName.
PhoneCallManager.ShowPhoneCallUI("9876543210", "Kunal Chowdhury");
Hope, this post will help you to understand the changes between Windows Phone 8.1 SDK and older versions of the SDK. Don’t forget to read my other posts on Windows Phone 8.1 (What changed for #WPDev) series mentioned above.
Thanks for visiting my blog. Bookmark this site for future reference. Share the posts that you liked and help others in your network to find the already available content easily. Don’t forget to subscribe to my blog’s RSS Feed and Email Newsletter to get regular updates about the posts directly delivered to your inbox. Apart from this blog, I am also available in Twitter, Facebook and Google+. Do connect with me to find out what I share over the network.