Android Context Check isVoiceSearchServiceExist(Context context)

Here you can find the source of isVoiceSearchServiceExist(Context context)

Description

is Voice Search Service Exist

Declaration

public static boolean isVoiceSearchServiceExist(Context context) 

Method Source Code

//package com.java2s;

import java.util.List;

import android.util.Log;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager;

import android.content.Context;

public class Main {
    static final String TAG = "LIMEUtilities";
    static final boolean DEBUG = true;

    public static boolean isVoiceSearchServiceExist(Context context) {
        InputMethodManager imm = (InputMethodManager) context
                .getSystemService(Context.INPUT_METHOD_SERVICE);
        List<InputMethodInfo> mInputMethodProperties = imm
                .getEnabledInputMethodList();

        boolean isVoiceSearchServiceEnabled = false;
        for (int i = 0; i < mInputMethodProperties.size(); i++) {
            InputMethodInfo imi = mInputMethodProperties.get(i);
            if (DEBUG)
                Log.i(TAG, "enabled IM " + i + ":" + imi.getId());

            if (imi.getId()
                    .equals("com.google.android.voicesearch/.ime.VoiceInputMethodService")) {
                isVoiceSearchServiceEnabled = true;
                if (DEBUG)
                    Log.i(TAG,//from  ww w .  j  av  a  2s  .  c  o m
                            "isVoiceSearchServiceExist(), voice input service ime found.");
                break;
            }
        }
        return isVoiceSearchServiceEnabled;

    }
}

Related

  1. isTablet(Context ctx)
  2. isTablet(final Context context)
  3. isThemeInstalled(Context c, String theme)
  4. isUpdateAvailable(Context paramContext, String paramString)
  5. isValidSigningKey(final Context context, final String certificateToCheckAgainst)