Code to make call in Windows Phone 7

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,

image

 

To work with PhoneCallTask, first you need to add namespace of Microsoft.Phone.Task

image

Then create instance of PhoneCallTask.

image

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,

image

And DisplayName as below,

image

Last step you need to launch making call application provided by operating system. You can show that as below,

image

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,

image

When you click on Call button, you will next screen as below for confirmation to call.

image

After choosing Call you will get usual Windows Phone 7 Call screen as below,

image

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 Smile

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.

6 responses to “Code to make call in Windows Phone 7”

  1. […] original post by Dhananjay Kumar at Debug Mode Launchers are used to perform task provided by phone operating system. Making Call is feature of […]

  2. nice post. i have just started developing mobile applications, just following you…
    hope i can do a lot of stuffs with these codes..
    thanks for sharing

  3. Nice post. Can you help me to use a method to end incoming calls?

    Thanks.

  4. […] Read more on Video on Code to make call in Windows Phone 7 by Dhananjay Kumar @DebugMode  […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at WordPress.com