Launchers are used to perform task provided by phone operating system. Making Call is feature of Windows phone operating system and can be used by Launcher API. PhoneCallTask launcher is used to call. This launcher class is defined as below,
To work with PhoneCallTask, first you need to add namespace of Microsoft.Phone.Task
Then create instance of PhoneCallTask.
Next you need to set values properties to make the call. To make the call you need to set below properties
- PhoneNumber
- DisplayName
So first set PhoneNumber property as below,
And DisplayName as below,
Last step you need to launch making call application provided by operating system. You can show that as below,
If you put all code together and want to make a call on click event of button then full code will be as below,
using System.Windows; using Microsoft.Phone.Controls; using Microsoft.Phone.Tasks; namespace Day6 { public partial class MainPage : PhoneApplicationPage { public MainPage() { InitializeComponent(); } private void btnCall_Click(object sender, RoutedEventArgs e) { PhoneCallTask callTask = new PhoneCallTask(); callTask.PhoneNumber = "999999"; callTask.DisplayName = "debugMode"; callTask.Show(); } } }
When you run above code you will get application running as below,
When you click on Call button, you will next screen as below for confirmation to call.
After choosing Call you will get usual Windows Phone 7 Call screen as below,
If you want you can very much end call, turn on speaker, mute hold or add call. I hope this post was useful. Thanks for reading
Follow @debug_mode
If you find my posts useful you may like to follow me on twitter http://twitter.com/debug_mode or may like Facebook page of my blog http://www.facebook.com/DebugMode.Net If you want to see post on a particular topic please do write on FB page or tweet me about that, I would love to help you.
Leave a Reply