Hi,
I write a code, and it works on android. And now i need made it works on iOS.
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { SpeechRecognition } from 'ionic-native';
import { AlertController } from 'ionic-angular';
import { Platform } from 'ionic-angular';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
recognition: any;
constructor(
public navCtrl: NavController,
public alertCtrl: AlertController,
public platform: Platform
) {
}
avaliable(){
SpeechRecognition.isRecognitionAvailable().then((available: boolean) => this.popup("Works?"," "+available));
}
hasPermition(){
SpeechRecognition.hasPermission().then((hasPermission: boolean) => this.popup("hasPermition?"," "+hasPermission));
}
requestPermition(){
SpeechRecognition.requestPermission().then(
() => this.popup('Permition','Granted'),
() => this.popup('Permition','Denied')
)
}
speak(){
let options = {
language:'en-US'
}
SpeechRecognition.startListening(options).subscribe(
(matches: Array<string>) => this.popup("You say:"," "+matches),
(onerror) => this.popup('error:',' '+onerror)
)
}
popup(titulo,subtitulo){
let alert = this.alertCtrl.create({
title: titulo,
subTitle: subtitulo,
buttons: ['OK']
});
alert.present();
}
}
I modified files ios.json, package.json, and put plugins on config.xml
some functions works Like:
SpeechRecognition.isRecognitionAvailable()
SpeechRecognition.hasPermission()
SpeechRecognition.requestPermission()
BUT
when i try SpeechRecognition.startListening(options)
this generate some errors:
2017-02-11 19:55:32.755076 speechWeb[1512:549049] startListening() recognitionTask error: Error Domain=kAFAssistantErrorDomain Code=216 "(null)"
2017-02-11 19:55:44.996131 speechWeb[1512:549092] startListening()
2017-02-11 19:56:47.192511 speechWeb[1512:549049] startListening() recognitionTask error: Error Domain=kAFAssistantErrorDomain Code=203 "Retry" UserInfo={NSLocalizedDescription=Retry, NSUnderlyingError=0x1702435a0 {Error Domain=SiriSpeechErrorDomain Code=1 "(null)"}}
Can someone knows if was missing some configuration for this works on ios?
I have no idea here =(