Hello I want build an app where my android app recognize my voice command & perform certain task. i have searched a lot but didn't find any valid solution. Kindly tell how to implement it?
            Asked
            
        
        
            Active
            
        
            Viewed 3,506 times
        
    2
            
            
        - 
                    1You should first try "Google Now" feature. – Lucifer Feb 25 '15 at 12:43
- 
                    1Have you tried googling it? There are so many tutorials. – Tushar Gogna Feb 25 '15 at 12:43
- 
                    Yes but did't meet my requirement – Tarun Sharma Feb 25 '15 at 12:46
- 
                    you may take a look at [this question][1] if you want offline speech recognition: [1]: http://stackoverflow.com/questions/17616994/offline-speech-recognition-in-android-jellybean – Milad Faridnia Feb 25 '15 at 12:52
1 Answers
3
            you may take a look at this question if you want offline speech recognition:
But there is also a another solution:
You can use this app which is made by google a few years ago. just install this app in your device and then simply call that app :
private void startRecognizeSpeech() {
    Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "en-US");
    try {
        startActivityForResult(intent, RESULT_SPEECH);
    } catch (ActivityNotFoundException a) {
        Toast.makeText(
                getApplicationContext(),
                "Oops! First you must download \"Voice Search\" App from Store",
                Toast.LENGTH_SHORT).show();
    }
}
Then in onActivityResult() do this :
@Override
// calls when voice recognition result received
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    switch (requestCode) {
    case RESULT_SPEECH: {
        if (resultCode == RESULT_OK && null != data) {
            // text is received form google
            ArrayList<String> text = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
 //you can find your result in text Arraylist  
        }
        break;
    }
 }
}
 
    
    
        Community
        
- 1
- 1
 
    
    
        Milad Faridnia
        
- 9,113
- 13
- 65
- 78
- 
                    What if i don't want to use google now.or any other installed app – Tarun Sharma Feb 25 '15 at 12:57
- 
                    1I've searched a little and unfortunately haven't find any other app. I just found some of googles apps. You can also use this library http://cmusphinx.sourceforge.net/wiki/tutorialandroid . thats an offline and open source voice recognition library – Milad Faridnia Feb 25 '15 at 13:09
