start an activity through a voice trigger command - android

I have been searching from last 9 or 10 days but I didn't get lucky enough to get my hands on some understandable code. I want to start my main activity through a trigger word like "ok google" or "open" my application receives the command and then performs some action. How can this be don, please provide a sample code.
Thanks very much in advance.

So you want to have a voice command that can open your when it's not open?
The only way you are allowed to do this is to use Accessibility Service. You will have to create your own service, implement the voice recognition, then user will have to manually turn the service on in their phone and based on the voice command, you can do whatever you want.
Basically:
Step 1) Develop Accessibility service
Step 2) Merge speech recognition with the service. Here is an example of speech recognition.
Step 3) User MUST turn on accessibility service
You are basically trying to creating an App like TalkBack, but only for your own app, which is no easy task. But i'm sure you can figure it out
Hope this helps. Good luck!

Related

Android App recognizing speech without button push

I'm looking to add voice commands to an Android App that will be running on a tablet as a kiosk. I don't want the user to have to push a button, because the user is doing something more important (e.g. driving a car, flying a plane, or performing brain surgery) and the command could be completed by a single button push.
I see tutorials describing how to add speech to text and have the user push a button and get the text, but nothing allowing the wake word "Okay, Google" to start the voice recognition (much less a custom wake word).
I looked at using the Google Voice Actions to start with "Okay, Google" and then send something to my app (register an intent), but that has to be trained to one specific user (at least for the tablet I tried it on). I'll have different users every day (maybe more than one a day) and no opportunity for training the device.
I've worked with CMUSphinx and found it to be too unreliable for spotting a wake word.
Is there a way to add "Okay, Google" as a way to start listening to text inside my app?
Got it working using PocketSphinx for offline wake work recognition and then I hand the microphone over to IBM's Watson's Speech to Text software that works over the internet and comes back with pretty reliable results.
Unfortunately what you are trying to achieve is not possible. If I understood correctly what your concept: a 3rd party app will awaken the devices and act based on a set of commands (from a security point of view this is very bad).
The closest you can do is follow the Voice Actions Api - https://developers.google.com/voice-actions/system/

Android - "OK Google" hotword recognition within app

I am trying to develop an app with voice commands to do different actions within my app. But to fire up the Speech listener module I want to use something like the Google's "OK Google" command which works without any manual touch input. This will help make my app completely hands-free.
Instead of re-creating what the google's service does, I wanted to know if it's possible to receive an event when "Ok google" is triggered.
Note: that this has to work only when my app is running not when it is closed.
Android Speech Recognition Without Dialog might be what you are looking for. Check it out.

Launch app on voice command android

i need an example of app launch on particular word. i know this is possible using speech recognition api. I just need a clue to start.
I see other apps are able to establish this.
I did this b4 using android service.i kept a background service working and added a listiner to it and keep checking the tresults if it equals ur voice command.
try to use Android Service which listens to voice + voice to text and you can go through the text and find the check word

Android speech to text for robot control

I am thinking about making an app that I can use to control my Arduino robot (over bluetooth/wifi) using voice commands. But to make the experience fluid, I will need the Android app speech recognition to be continuously running. If I want the robot to stop, I don't want to press a button, wait for the speech recognition dialog to appear, say my command "STOP", release the button, wait for the parser to parse it, and then send the stop command.
I would rather just have the Speech to Text in continuous listen mode when I am controlling my robot. And when it hears keywords, it sends them.
Can I do this in Android? I did some googling, and I found the recognizer intent, but all of the examples I found use a button trigger and pretty much followed the scenario I described above.
It can be done. Look at this link. It has also some example code :)
You can make it listen and when it speeches you get the word see if it is a keyword and then make the robot do as you want.
http://viralpatel.net/blogs/android-speech-to-text-api/

Voice recognition APIs, will Google Voice do this?

I've got an idea for an android app, I want to be able to say commands and have the application listen out for these and perform some action.
For example, I want my app to sit idle and listen for my voice, when it hears me say "start", the app will start doing something until I say "stop".
The idea is to lay the phone down and not have to physically touch it in order to control my app.
Would this be possible with any current APIs? If so which ones should I look into?
You can take a look at the Google voice commands.
http://www.google.com/mobile/voice-actions/
Alternatively, if you want to customise your application, you can use the google voice service and write an activity that will invoke the voice service and return you the result.
Check out the below link for the sample application.
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/VoiceRecognition.html

Categories

Resources