I have a below requirement in Windows Phone 8 to run voice listener in background agent whenever an incoming call comes or for an outgoing call. The voice listener should stop when there was NO call.
Eg: When I lift an incoming call and while speaking. I would like to say a voice command say "SPEAKER", then the speaker should ON
I saw obscured events can be used for detecting calls. But am unable to start the voice listener from background agent. Kindly please assist.
Here is the method I am using in the ScheduledAgent.cs file, but no luck
private async void SpeakTest()
{
SpeechRecognizerUI speechRecognition = new SpeechRecognizerUI();
SpeechRecognitionUIResult recoResult = await speechRecognition.RecognizeWithUIAsync();
if (recoResult.ResultStatus == SpeechRecognitionUIStatus.Succeeded)
{
lblMessage.Text = recoResult.RecognitionResult.Text;
}
}