This repository has been archived by the owner on Apr 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 77
Add 3rd Party Plugins
John Feagans edited this page Apr 4, 2015
·
7 revisions
- Additions to cordova_plugins.js
- Updates to manifest.plist
- Source code to build plugin
- Javascript in www/plugins directory
org.apache.cordova.speech.SpeechRecognition
Here are the highlights of the plugin.xml file and what must be done with each section:
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" id="org.apache.cordova.speech.speechrecognition" version="0.1.0">
<name>SpeechRecognition</name>
<description>Cordova Speech Recognition Plugin</description>
<license>Apache</license>
<keywords>cordova,speech,recognition</keywords>
<js-module src="www/SpeechRecognition.js" name="SpeechRecognition">
<clobbers target="SpeechRecognition" />
</js-module>
<platform name="ios">
<config-file target="config.xml" parent="/*">
<feature name="SpeechRecognition">
<param name="ios-package" value="SpeechRecognition"/>
</feature>
</config-file>
<source-file src="src/ios/SpeechRecognition.m" />
<source-file src="src/ios/libiSpeechSDK.a" framework="true" />
<header-file src="src/ios/SpeechRecognition.h" />
<framework src="AudioToolbox.framework" />
<framework src="SystemConfiguration.framework" />
<framework src="Security.framework" />
<framework src="CFNetwork.framework" />
<resource-file src="src/ios/iSpeechSDK.bundle" />
</platform>
Each module section like:
<js-module src="www/SpeechRecognition.js" name="SpeechRecognition">
<clobbers target="SpeechRecognition" />
</js-module>
Turns into this in the module_exports array
{
"file": "plugins/org.apache.cordova.speech/www/SpeechRecognition.js",
"id": "org.apache.cordova.speech.SpeechRecognition",
"clobbers": [
"SpeechRecognition"
]
},
<feature name="SpeechRecognition">
<param name="ios-package" value="SpeechRecognition"/>
</feature>
Into the tags in manifest.plist:
<key>cordova_plugins</key>
<array>
<dict>
<key>class</key> // this is the value of “ios-package”
<string>SpeechRecognition</string>
<key>name</key> // this is the name property of “feature”
<string>SpeechRecognition</string>
</dict>
</array>
Create a directory org.apache.cordova.speech/www and copy the Javascript files from the original plugin www directory.
<source-file src="src/ios/SpeechRecognition.m" />
<source-file src="src/ios/libiSpeechSDK.a" framework="true" />
<header-file src="src/ios/SpeechRecognition.h" />
<framework src="AudioToolbox.framework" />
<framework src="SystemConfiguration.framework" />
<framework src="Security.framework" />
<framework src="CFNetwork.framework" />
<resource-file src="src/ios/iSpeechSDK.bundle" />
For now we don’t provide configuration support of the source codes and libraries, so just add all them into the projects, link the libraries with your target. You may refer to the CordovaPluginFileDemo project.
sdfsdf