|  | 
| 1 | 1 | # UnityAndroidSpeechRecognition | 
| 2 |  | -This repository is a Unity plugin for Android Speech Recognition (based on Java implementation) | 
|  | 2 | +This repository is a Unity plugin for Android Speech Recognition (based on Java implementation). This is just a basic implementation with not many functions to change various properties of speech recognition. I plan to add more things once I get more free time.  | 
|  | 3 | + | 
|  | 4 | +## Usage | 
|  | 5 | + | 
|  | 6 | +* You can first test out the `SpeechRecognition.apk` from [here](https://github.com/gsssrao/UnityAndroidSpeechRecognition/releases/tag/1.0). | 
|  | 7 | +* Next, import `SpeechRecognition.unitypackage` into your Unity project.  | 
|  | 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. | 
|  | 14 | +* 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. | 
|  | 15 | + | 
|  | 16 | +## Note | 
|  | 17 | + | 
|  | 18 | +* 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. | 
|  | 19 | + | 
|  | 20 | +* If anyone experiences any issues, feel free to create an issue. | 
|  | 21 | + | 
0 commit comments