watson-developer-cloud / speech-android-sdk

DEPRECATED - Please use https://github.com/watson-developer-cloud/android-sdk
Apache License 2.0
67 stars 53 forks source link

New Project Quick Start Guide #9

Closed KeyOnTech closed 5 years ago

KeyOnTech commented 8 years ago

This is an extension to my original posting

https://github.com/watson-developer-cloud/speech-android-sdk/issues/7

explaining how to get the demo project provided on the GitHub page working.

https://github.com/watson-developer-cloud/speech-android-sdk

This post is helping users who want to start a new project and use the SDK, these steps are as of 3-2-2016. I am writing as I am doing them...

Download the project zip file

https://github.com/watson-developer-cloud/speech-android-sdk

Open Android Studio Create a New Project Name it min SDK API 15 or anything above... select Blank Activity WITH Fragment

Once it finishes the setup Select File > Import Module > for source directory find the folder you unzipped in your downloads folder, within that folder select the folder "speech-android-wrapper" > leave the default name for Module name or call it what you like... > Finish

This will copy the folder into your project and project directory

Now make it accessible to the project

Right click your project on the top left ( not the newly added library the "app" folder or whatever it is called on the top left...) > Select Open Module Settings > select "app" click on dependencies > click + add Module Dependency > select the speech-android-wrapper project module > Ok

No go to the project folder "app" > select your fragment activity file

Add the ISPeechDelegate interface to the Fragment public class Fragment1 extends Fragment implements ISpeechDelegate

Implement all the Override methods required by the interface The onMessage method will be used to capture the speech to text returns from the SDK, the other methods are pretty self explanatory...

Under onCreateView method add SpeechConfiguration sConfig = new SpeechConfiguration ( SpeechConfiguration.AUDIO_FORMAT_OGGOPUS );

Now run and confirm it Builds Successfully

Thats it for the setup now you can use the library

Now you can add a sharedInstance.initWithContext( ...) ... set the setCredentials set the setModel set the setDelegate ( this ) ...

This will setup the app and prepare you to follow what is on the start up guide

https://github.com/watson-developer-cloud/speech-android-sdk

Hope this helps new users get started.