Freigeben über


How to use the phone call task for Windows Phone 8

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Use the phone call task to enable users to make a phone call from your application. The phone call task launches the Phone application and displays the phone number and display name that you specify. The phone call is not placed until the user presses the call button.

By using Launchers, you help provide a consistent user experience throughout the Windows Phone platform. For more information, see Launchers and Choosers for Windows Phone 8.

Note

On Windows Phone Emulator, placed phone calls always connect, but the connection is simulated in the emulator. The emulator uses Fake GSM and always has a false Subscriber Identity Module (SIM) card.

To use the phone call task

  1. Add the following statement to your code.

    using Microsoft.Phone.Tasks;
    
    Imports Microsoft.Phone.Tasks
    
  2. Add the following code to your application wherever you need it, such as in a button click event. To test this procedure, you can put the code in the page constructor. This is the code to launch the task.

    PhoneCallTask phoneCallTask = new PhoneCallTask();
    
    phoneCallTask.PhoneNumber = "2065550123";
    phoneCallTask.DisplayName = "Gage";
    
    phoneCallTask.Show();
    
    Dim phoneCallTask as PhoneCallTask = new PhoneCallTask()
    
    phoneCallTask.PhoneNumber = "2065550123"
    phoneCallTask.DisplayName = "Gage"
    
    phoneCallTask.Show()
    

Note

If the phone does not have a SIM card, the application prompts the user to add one.

See Also

Reference

PhoneCallTask

Other Resources

How to use the phone number chooser task for Windows Phone 8

How to use the save phone number task for Windows Phone 8