UWP使用Skype拨打电话 [英] UWP use skype to call number

查看:136
本文介绍了UWP使用Skype拨打电话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的c#UWP App支持呼叫号码。

I want my c# UWP App to support calling numbers.

当我在W10移动版上时,我希望它正常使用W10 PhoneCall API(此方法有效)

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);

但是在W10台式机/ PC上我没有GSM提供商,所以我想,也许可以使用用户按下Skype拨打该号码。

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.

通过UWP可以吗?也许像打开网站一样:

Is that possible via UWP? Maybe similar like opening websites:

await Windows.System.Launcher.LaunchUriAsync(new Uri(website));


推荐答案

是的,有可能,您正确使用启动URI的默认应用以从您的应用中打开Skype。

Yes, it's possible and you're right about using Launch the default app for a URI to open Skype from your app.

关于我们可以使用什么Uri的问题,您可以参考 Skype开发

For the question what Uri can we use, you can refer to Skype development.

以下是示例代码,它将打开 Skype并调用回声/声音测试服务:

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");

或者您也可以通过Skype ID致电:

Or you can also call by the skype id:

var uriSkype = new Uri(@"Skype:(skype id)?call");

此解决方案仅在PC上已安装Skype时有效。如果系统在您的PC上找不到Skype,它将打开商店并显示注册了此协议的推荐应用。

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.

这篇关于UWP使用Skype拨打电话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆