is ACTION RECOGNIZE SPEECH Available - Android android.speech

Android examples for android.speech:RecognizerIntent

Description

is ACTION RECOGNIZE SPEECH Available

Demo Code

import java.util.List;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.speech.RecognizerIntent;

public class Main{

    public static boolean isTTSAvailable(Context context) {
        PackageManager packageManager = context.getPackageManager();
        Intent speechIntent = new Intent(
                RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
        List<ResolveInfo> speechActivities = packageManager
                .queryIntentActivities(speechIntent, 0);
        if (speechActivities.size() != 0)
            return true;
        return false;
    }//  w  ww.java  2s.co m

}

Related Tutorials