Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

How to call a CordovaPlugin without ngCordova?

$
0
0

@alanmarth wrote:

I want to use SpeechRecognitionPlugin in my app:

https://github.com/macdonst/SpeechRecognitionPlugin

Since it isn't in ngCordova, I can't simply call the service, but the code to access it is:

<script type="text/javascript">
var recognition;
document.addEventListener('deviceready', onDeviceReady, false);

function onDeviceReady() {
recognition = new SpeechRecognition();
recognition.onresult = function(event) {
if (event.results.length > 0) {
q.value = event.results[0][0].transcript;
q.form.submit();
}
}
}
</script>

I know that I have to use a controller, I tried to wrap it in $ionicPlatform.ready, but still it doesn't work. It seems that I cant simply initialize the SpeechRecognition() object. What is the correct way to access to that object?

I found an js file inside puglin's folder that contains that object. It is declared as follows:

var exec = require("cordova/exec");

/**
attribute SpeechGrammarList grammars;
attribute DOMString lang;
attribute boolean continuous;
attribute boolean interimResults;
attribute unsigned long maxAlternatives;
attribute DOMString serviceURI;
*/
var SpeechRecognition = function () {

....

module.exports = SpeechRecognition;

Script url: * alphalingo\plugins\org.apache.cordova.speech.speechrecognition\www*

Do I have to call that script from somewhere? Thank you guys.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>