Skip to content

Commit 5acf387

Browse files
G S S Srinivas RaoG S S Srinivas Rao
G S S Srinivas Rao
authored and
G S S Srinivas Rao
committed
Updated README
1 parent ebd7160 commit 5acf387

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

README.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
11
# UnityAndroidSpeechRecognition
2-
This repository is a Unity plugin for Android Speech Recognition (based on Java implementation). This is just a basic implementation which uses the inbuilt Android Speech Recognition. I have not implemented any functions to change any properties of speech recognition. I plan to add more things once I get more free time.
2+
This repository is a Unity plugin for Android Speech Recognition (based on Java implementation). This is just a basic implementation which uses the inbuilt Android Speech Recognition. I have implemented some additional functions to give some basic functionality.
3+
4+
## Features
5+
6+
* Set Recognition Language
7+
* Set the max number of results
8+
* Set the prompt question
39

410
## Usage
511

6-
* You can first test out the `SpeechRecognition.apk` from [here](https://github.com/gsssrao/UnityAndroidSpeechRecognition/releases/tag/1.0). You need a minimum of Android Lollipop to use this apk.
7-
* Next, import `SpeechRecognition.unitypackage` into your Unity project. (Tested on `Unity 5.1.1.f1`)
8-
* To include SpeechReconginition in your own project copy the contents of `Plugins/Android/` into the same folder in your project.
9-
* Have a look at `TestPlugin.cs` for an example usage.
10-
* When you press the button, a speech recognition itent should pop up. This intent sends the recognized text to 'void onActivityResult(string Translation)' function of the object 'MainCamera' (it calls 'MainCamera' and not 'Main Camera').
11-
* You can import `TestSpeech` to Android Studio to experiment with it (`speechassist` module is only important).
12-
* Once you make changes and build the module you should have a `speechassist-debug.aar` file in `TestSpeech/speechassist/build/outputs/aar` folder. Rename this to `speechassist-debug.zip` and then unzip it. On unzipping you will get a `classes.jar` file which you will have to copy into `Plugins/Android` folder in Unity.
13-
* If you make any changes to Andriod activites like `UnityPlayerActivity` please copy the manifest of `speechassist` module as well to `Plugins/Android` folder.
12+
* You can first test out the `SpeechRecognition.apk` from [here](https://github.com/gsssrao/UnityAndroidSpeechRecognition/releases/download/2.0/SpeechPlugin.apk). You need a minimum of Android Lollipop (API Level 21) to use this apk.
13+
* Next, import `SpeechRecognition.unitypackage` into your Unity project. (Tested latest on `Unity 2018.1.0f2`)
14+
* To include SpeechReconginition in your own project copy the contents of `Plugins/Android/` into the same folder in your project and have a look at `Test.cs` and `ReceiveResult.cs` for an example usage. `Test.cs` has function for calling the speech recognition popoup whereas `ReceiveResult.cs` has function which receives the recognized text.
15+
* When you press the button, a speech recognition itent should pop up. This intent sends the recognized text to 'void onActivityResult(string recognizedText)' function of the object 'Main Camera' (You can change the object to which `ReceiveResult.cs` should be attached by changing the object name in `Test.cs`. The default return object is set to 'Main Camera').
16+
* You can change the following line `pluginClass.CallStatic("setLanguage", "en_US")` in `Test.cs` to change the language. A list of languages along with their tags is present in the `languages.txt` file. This file is **not exhaustive**.
17+
* Similarly you can also manipulate other features like maximum number of results etc (In case of the max number of results, this is literally maximum and the number of results you get may not always be this number, but it would be definitely less than this number).
18+
19+
## Experimenting
20+
21+
* You can import `SpeechPlugin` to Android Studio to experiment with it (`pluginlibrary` module is only important).
22+
* Once you make changes and build the module you should have a `pluginlibrary-release.aar` file in `SpeechPlugin/pluginlibrary/build/outputs/aar` folder. Rename this to `speechassist-debug.zip` and then unzip it. On unzipping you will get a `classes.jar` file which you will have to copy into `Plugins/Android` folder in Unity along with the `AndroidManifest.xml`. The manifest specifies the activity class which extends the `UnityPlayerActivity` and hence is necessary. If you already have a manifest in plugins folder, I would recommend against copying this manifest as it can cause confilict. Instead, you can modify the manifest which you already have to specify the activity class which extends the `UnityPlayerActivity`.
1423
* One more thing to observe is that I have `classes.jar` in my libs folder of my AndroidStudio project. Have a look at [this](http://answers.unity3d.com/questions/182912/location-of-playbackenginesandroidplayerbin-on-a-m.html) post to know where you can find it.
1524

1625
## Note
1726

1827
* I have extended `UnityPlayerActivity` with my custom activity and forced to subsitute it by changing the manifest file. Though, this works it is undesirable when you want to make/use multiple plugins. An ideal way would be to create a custom activity that will be short-lived and its sole purpose would be to get created, do the job (user picks photo from gallery e.g.), deliver result (picked image) into `onActivityResult` and terminate itself. Please refer [this](https://medium.com/@tarasleskiv/unity-android-plugins-and-onactivityresult-callback-abef4b6bbc87#.v81an68si) post for more details on this approach. I will update the plugin once I have more free time.
1928

20-
* On experiecing a problem, feel free to create an issue.
29+
* On experiencing a problem, feel free to create an issue.
2130

31+
* If you want any additional features too feel free to create an issue.

0 commit comments

Comments
 (0)