This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using Android.App; | |
using Android.Content; | |
using Android.OS; | |
using Android.Runtime; | |
using Android.Views; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void StartRecordingAndRecognizing() | |
{ | |
string rec = global::Android.Content.PM.PackageManager.FeatureMicrophone; | |
if (rec == "android.hardware.microphone") | |
{ | |
var voiceIntent = new Intent(RecognizerIntent.ActionRecognizeSpeech); | |
voiceIntent.PutExtra(RecognizerIntent.ExtraLanguageModel, RecognizerIntent.LanguageModelFreeForm); | |
voiceIntent.PutExtra(RecognizerIntent.ExtraPrompt, "Speak now"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Android.App; | |
using Android.Content; | |
using Android.Content.PM; | |
using Android.OS; | |
using Android.Speech; | |
using Xamarin.Forms; | |
namespace XFSpeechDemo.Droid | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using Android.App; | |
using Android.Content; | |
using Android.OS; | |
using Android.Runtime; | |
using Android.Speech; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<key>NSSpeechRecognitionUsageDescription</key> | |
<string>Allows you create tasks</string> | |
<key>NSMicrophoneUsageDescription</key> | |
<string>Allows you to recognise your voice to create tasks</string> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<key>NSSpeechRecognitionUsageDescription</key> | |
<string>Allows you create tasks</string> | |
<key>NSMicrophoneUsageDescription</key> | |
<string>Allows you to recognise your voice to create tasks</string> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void ConnectToWatson() | |
{ | |
_conversation = new ConversationService("watson username", "watson assitant password", "2018-09-10"); | |
_conversation.SetEndpoint("watson gateway"); | |
} | |
#gateway = https://gateway.watsonplatform.net/conversation/api | |
#gateway = https://gateway.watsonplatform.net/assistant/api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MessageRequest mr = new MessageRequest() | |
{ | |
Input = new InputData() | |
{ | |
Text = temp | |
}, | |
}; | |
await Task.Run(() => { | |
var res = _conversation.Message("watson workspace id", mr); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MessageRequest mr = new MessageRequest() | |
{ | |
Input = new InputData() | |
{ | |
Text = temp | |
}, | |
Context =_context | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
await Task.Run(() => { | |
var res = _conversation.Message("watson workspace id", mr); | |
_context = res.Context; | |
OnWatsonMessagerecieved(JsonConvert.SerializeObject(res, Formatting.Indented)); | |
}); | |
private void OnWatsonMessagerecieved(string data) | |
{ |