Code example for InputMethodService

Methods: getSystemService

    private boolean isNetworkAvailable() { 
        try { 
            ConnectivityManager connectivityManager = (ConnectivityManager) mInputMethodService
            final NetworkInfo info = connectivityManager.getActiveNetworkInfo();
            return info != null && info.isConnected();
        } catch (SecurityException e) {
            // The IME does not have the permission to check the networking 
            // status. We hope for the best. 
            return true; 
     * Register a listener to receive a notification every time the status of 
     * Voice IME may have changed. The {@link Listener} should 
     * update the UI to reflect the current status of Voice IME. When 
Experience pair programming with AI  Get Codota for Java