3

我正在尝试以编程方式调用 Cortana。

我已经在使用此代码启动 Cortana

await Launcher.LaunchUriAsync(new Uri("bing://home"));

问题是为了进行搜索,您必须单击 Cortana 中的麦克风按钮。

我想要的是,当 Cortana 启动时,不应提示用户按下麦克风按钮以进行搜索。就像在 Cortana 中一样,只要我愿意,或者至少在它打开时,它就会开始收听。

这可能吗?如果是,那怎么办?

4

2 回答 2

3

这是极不可能的,因为应用程序开发人员能够任意开始记录用户所说的内容存在隐私问题。

于 2015-06-03T10:09:30.570 回答
1

您是否尝试过在 Windows 10 上使用 ContinuousRecognitionSession。

private SpeechRecognizer speechRecognizer;
private CoreDispatcher dispatcher;
private StringBuilder dictatedTextBuilder;

this.dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;
this.speechRecognizer = new SpeechRecognizer();
SpeechRecognitionCompilationResult result =

await speechRecognizer.CompileConstraintsAsync();
speechRecognizer.ContinuousRecognitionSession.ResultGenerated +=
ContinuousRecognitionSession_ResultGenerated;

private async void ContinuousRecognitionSession_ResultGenerated(
SpeechContinuousRecognitionSession sender,
SpeechContinuousRecognitionResultGeneratedEventArgs args)
{

if (args.Result.Confidence == SpeechRecognitionConfidence.Medium ||
  args.Result.Confidence == SpeechRecognitionConfidence.High)
  {
    dictatedTextBuilder.Append(args.Result.Text + " ");

    await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
    {
      dictationTextBox.Text = dictatedTextBuilder.ToString();
      btnClearText.IsEnabled = true;
    });
  }
else
{
  await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
    {
      dictationTextBox.Text = dictatedTextBuilder.ToString();
    });
}
}

这是完整的例子

考虑在前台也使用 Cortana 集成您的应用程序。看看这里

于 2015-08-04T16:41:38.980 回答