Code example for ConnectivityManager

Methods: getMobileDataEnabled

0
        getIcons(R.drawable.toggle_data_off, R.drawable.toggle_data); 
        updateController(); 
    } 
 
    protected int getPreferenceStatus() { 
        return (mConnService.getMobileDataEnabled() ? 1 : 0);
    } 
 
    protected void setPreferenceStatus(int status) {
        if (status == 1) {
            mConnService.setMobileDataEnabled(true);
        } 
        else { 
            mConnService.setMobileDataEnabled(false);
        } 
    } 
}