Upload
kaoru-nakajima
View
316
Download
3
Embed Size (px)
DESCRIPTION
Windows Phone 8.1のCortanaアプリをさくっと作るための手順を簡単に紹介します。 割と簡単なんで、ぜひあなたのアプリもCortana対応に。 デバッグはエミュレーターのテキスト入力でもできます。
Citation preview
[即席]Cortana対応アプリを作る
今すぐ!
Kaoru Nakajima
2014/05/17
ネタ元
Quickstart: Voice commands (Windows Phone Store apps using C#/VB/C++ and XAML) (Preliminary)http://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn630430.aspx
WinRT Voice Commands Sample for Cortana integration for WP 8.1 - Home
http://voicecommands.codeplex.com/
Voice command element and attribute reference (Windows Phone Store apps using C#/VB/C++ and XAML) (Preliminary)
http://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn630431.aspx
プロジェクトを作成
▌ターゲットプロジェクトはこの2つのどちらか
▌ストアアプリ/Windows Phone アプリ
▌ストアアプリ/ユニバーサルアプリ
音声辞書ファイル(XML)を作成
▌追加/XMLファイル
▌ファイル名はテキトウ
▌VCD~.xmlとか
▌ファイルプロパティでコンテンツ/出力ディレクトリにコピー:新しい場合はコピーする
Cortanaにアプリを登録
とりあえず、VoiceCommandManager.InstallCommandSetsFromStorageFileAsync()
すればいい。
Uri uri = new Uri("ms-appx:///VCD.xml", UriKind.Absolute);
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(uri);
await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(file);
一度でも実行されれば登録されるのでApp.xaml.csのOnLaunchedとかから実行されればいい
#if WINDOWS_PHONE_APPを忘れずに!
マイク対応アプリにする
▌プロジェクトのプロパティ/アプリケーション/パッケージマニフェスト
▌機能でマイクをチェック
Cortanaから起動後の処理
App.xaml.csのOnActivateで
protected override void OnActivated(IActivatedEventArgs args)
var vcArgs = args as VoiceCommandActivatedEventArgs;
…
vcArgsを処理する
以上
ネタ元
Quickstart: Voice commands (Windows Phone Store apps using C#/VB/C++ and XAML) (Preliminary)http://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn630430.aspx
WinRT Voice Commands Sample for Cortana integration for WP 8.1 - Home
http://voicecommands.codeplex.com/
Voice command element and attribute reference (Windows Phone Store apps using C#/VB/C++ and XAML) (Preliminary)
http://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn630431.aspx