Code example for InputMethodService

Methods: getSystemService

0
    } 
 
    private boolean isNetworkAvailable() { 
        try { 
            ConnectivityManager connectivityManager = (ConnectivityManager) mInputMethodService
                    .getSystemService(
                    Context.CONNECTIVITY_SERVICE);
            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