Today, when I created an app in Windows Phone 8, I had the requirement to to make a call in Windows Phone.
Code of xaml.cs
- private void PhoneCall_Click(object sender, RoutedEventArgs e)
- {
- PhoneCallTask phoneCallTask = new PhoneCallTask();
-
- phoneCallTask.PhoneNumber = "9717098666";
- phoneCallTask.DisplayName = "Dhananjay";
- phoneCallTask.Show();
- }
Code of XAML
- <Button x:Name="PhoneCall" Content="Button" HorizontalAlignment="Left" Margin="247,464,0,0" VerticalAlignment="Top" Click="PhoneCall_Click"/>
But while running an application, I encountered an error.
The error was: “An unhandled exception of type 'System.UnauthorizedAccessException' occurred in System.Windows.ni.dll”.
After some time I solved the error. I simply checked this Windows Phone Project by enabling (checking) the option ID_CAP_PHONEDIALER in the WMAppManifest.xml file of the Windows Phone Project to enable the option.
After that, I again ran the application and made a call.
Then:
Summary
This article described how to make a call in Windows Phone 8.