I want my c# UWP App to support calling numbers.
When I'm on W10 mobile I want it to use W10 PhoneCall API normal (this is working)
Windows.ApplicationModel.Calls.PhoneCallManager.ShowPhoneCallUI(number, name);
but on W10 Desktop/PC I won't have a GSM provider, so I thought, maybe use skype to call the number, the user pressed.
Is that possible via UWP? Maybe similar like opening websites:
await Windows.System.Launcher.LaunchUriAsync(new Uri(website));
Yes, it's possible and you're right about using Launch the default app for a URI to open Skype from your app.
For the question what Uri can we use, you can refer to Skype development.
Here is the sample code, this will open "Skype" and call the "Echo/Sound Test Service":
private async void OnClick(object sender, RoutedEventArgs e)
{
var uriSkype = new Uri(@"Skype:echo123?call");
// Set the option to show a warning
var promptOptions = new Windows.System.LauncherOptions();
promptOptions.TreatAsUntrusted = true;
// Launch the URI
var success = await Windows.System.Launcher.LaunchUriAsync(uriSkype, promptOptions);
if (success)
{
// URI launched
}
else
{
// URI launch failed
}
}
If you want to call number, you can use:
var uriSkype = new Uri(@"Skype:(number)?call");
Or you can also call by the skype id:
var uriSkype = new Uri(@"Skype:(skype id)?call");
This solution works only when Skype is already installed on your PC. If system can not find Skype on your PC, it will open the Store and show the recommended apps which registered this protocol.
来源:https://stackoverflow.com/questions/34777603/uwp-use-skype-to-call-number