Skip to content

Commit b918044

Browse files
committed
Working Android version.
0 parents  commit b918044

13 files changed

+1973
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

libs/android/armeabi/libnmsp_speex.so

608 KB
Binary file not shown.

libs/android/nmdp_speech_kit.jar

218 KB
Binary file not shown.

plugin.xml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
3+
id="net.ninjaenterprises.nuance" version="0.1.0">
4+
<name>Device</name>
5+
<description>Cordova Nuance Ndev Plugin</description>
6+
<license>Apache 2.0</license>
7+
<keywords>cordova,voice_recognition</keywords>
8+
<js-module src="www/nuancespeechkit.js" name="NuancePlugin">
9+
<clobbers target="NuancePlugin" />
10+
</js-module>
11+
<platform name="ios">
12+
<config-file target="config.xml" parent="/*">
13+
<feature name="NuancePlugin">
14+
<param name="ios-package" value="NuancePlugin"/>
15+
<param name="onload" value="true" />
16+
</feature>
17+
</config-file>
18+
<header-file src="src/ios/NuancePlugin.h" />
19+
<source-file src="src/ios/NuancePlugin.m" compiler-flags="-fno-objc-arc" />
20+
<header-file src="src/ios/ICredentials.h" />
21+
<header-file src="src/ios/Credentials.h" />
22+
<source-file src="src/ios/Credentials.m" />
23+
24+
<framework src="AssetsLibrary.framework" />
25+
<framework src="Security.framework" />
26+
<framework src="Foundation.framework" />
27+
<framework src="CoreMedia.framework" />
28+
<framework src="MediaPlayer.framework" />
29+
<framework src="SystemConfiguration.framework" />
30+
<framework src="CFNetwork.framework" />
31+
<framework src="AVFoundation.framework" />
32+
<framework src="AudioToolbox.framework" />
33+
<framework src="CoreGraphics.framework" />
34+
</platform>
35+
36+
<platform name="android">
37+
<config-file target="res/xml/config.xml" parent="/*">
38+
<feature name="NuancePlugin" >
39+
<param name="android-package" value="net.ninjaenterprises.nuance.NuancePlugin"/>
40+
</feature>
41+
</config-file>
42+
43+
<config-file target="AndroidManifest.xml" parent="/*">
44+
<uses-permission android:name="android.permission.RECORD_AUDIO" />
45+
</config-file>
46+
47+
<source-file src="src/android/CredentialsParser.java" target-dir="src/net/ninjaenterprises/nuance" />
48+
<source-file src="src/android/NuancePlugin.java" target-dir="src/net/ninjaenterprises/nuance" />
49+
50+
<source-file src="libs/android/nmdp_speech_kit.jar" target-dir="libs" />
51+
<source-file src="libs/android/armeabi/libnmsp_speex.so" target-dir="libs/armeabi" />
52+
</platform>
53+
54+
</plugin>

src/android/CredentialsParser.java

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package net.ninjaenterprises.nuance;
2+
import android.util.Log;
3+
4+
public class CredentialsParser {
5+
private byte[] secret;
6+
7+
public CredentialsParser(String secret) {
8+
this.secret = hexStringToByteArray(secret);
9+
}
10+
11+
public byte[] get() {
12+
return secret;
13+
}
14+
15+
// thanks http://stackoverflow.com/questions/140131/convert-a-string-representation-of-a-hex-dump-to-a-byte-array-using-java
16+
public static byte[] hexStringToByteArray(String s) {
17+
int len = s.length();
18+
byte[] data = new byte[len / 2];
19+
for (int i = 0; i < len; i += 2) {
20+
data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
21+
+ Character.digit(s.charAt(i+1), 16));
22+
}
23+
return data;
24+
}
25+
26+
}

0 commit comments

Comments
 (0)