Code example for ConnectivityManager

Methods: getMobileDataEnabled

0
        getPreferenceScreen().setEnabled(true);
 
        ConnectivityManager cm =
                (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
 
        mButtonDataEnabled.setChecked(cm.getMobileDataEnabled());
 
        // Set UI state in onResume because a user could go home, launch some 
        // app to change this setting's backend, and re-launch this settings app 
        // and the UI state would be inconsistent with actual state 
        mButtonDataRoam.setChecked(mPhone.getDataRoamingEnabled());
        mDataUsageListener.resume();
    } 
 
    @Override 
    protected void onPause() { 
        super.onPause(); 
        mDataUsageListener.pause();
    } 
 
    private static void log(String msg) {