Closed PetterSunnyVR closed 7 years ago
the js code is not valid. use a js validator like eslint
On 7 May 2017 12:51, "PiotrMa" notifications@github.com wrote:
Hi I have some problem with startListening() - it doesnt work. My code: `window.plugins.speechRecognition.isRecognitionAvailable( function(){
window.plugins.speechRecognition.hasPermission( function(){ alert("hello") /*window.plugins.speechRecognition.startListening( function(){ alert("recorded"); }, function(errorMsg){ alert(errorMsg); }, { String language = window.navigator.language, Number matches = 1, String prompt = "", // Android only Boolean showPopup = false, // Android only });*/ }, function(){alert("App doesn't have permissions granted.");}); }, function(){alert("Somethign went wrong.");}
);`
RIght now "hello" alert pops up before the recording" page is loaded - my first cordova project, and if I uncomment startListening() the popup doesnt show up at all and nothing happens.
This code should run after pushing a button in "home_page" but after loading "add_page". Am i also not sure if Function successCallback should be function(result){ //result = array ?}. I would really apprecieate help or working example.
Thanks
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pbakondy/cordova-plugin-speechrecognition/issues/35, or mute the thread https://github.com/notifications/unsubscribe-auth/AAej2WPzp1XkSQzE49tZEODndNjvrU6Tks5r3aIXgaJpZM4NTGep .
Here is the error { String language = window.navigator.language, Number matches = 1, String prompt = "", // Android only Boolean showPopup = false, // Android only }
It should be this
{ language: window.navigator.language, matches : 1, prompt : "", // Android only showPopup : false, // Android only }
Wow, that was foolish of me. Thanks! But still despite hasPermission returns ok when running startListening() it throws errorCode = "missing perminnions". My permissions in manifext file:
`
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />`
Fixed code: `(document).on('pageshow','#add',function(){
window.plugins.speechRecognition.isRecognitionAvailable(
function(){
window.plugins.speechRecognition.hasPermission(
function(){
alert("Permission granted. Trying...");
alert(options.language);
window.plugins.speechRecognition.startListening(
function(result){alert(result);}, function(errormsg){alert(errormsg);}, options);
here it throws errormsg on emulator and on device
},
function(){alert("App doesn't have permissions granted.");});
},
function(){alert("Somethign went wrong.");}
);
});`
UPDATE:
Ok, I have requested permissions using:
window.plugins.speechRecognition.requestPermission( function(){alert("requested permission granted");}, function(){alert("permission denied");});
and all works now. Thanks again for help.
Hi I have some problem with startListening() - it doesnt work. My code: `window.plugins.speechRecognition.isRecognitionAvailable( function(){
RIght now "hello" alert pops up before the recording" page is loaded - my first cordova project, and if I uncomment startListening() the popup doesnt show up at all and nothing happens.
This code should run after pushing a button in "home_page" but after loading "add_page". Am i also not sure if Function successCallback should be function(result){ //result = array ?}. I would really apprecieate help or working example.
Thanks