Code example for ConnectivityManager

Methods: setMobileDataEnabled

0
 
    } 
 
    @Override 
    protected void doEnable() { 
        connManager.setMobileDataEnabled(true);
        // String strData = connManager.getMobileDataEnabled() ? 
        // mContext.getString(R.string.quick_settings_data_on_label) 
        // : mContext.getString(R.string.quick_settings_data_off_label); 
        // Toast.makeText(mContext, strData, Toast.LENGTH_SHORT).show(); 
    } 
 
    @Override 
    protected void doDisable() { 
        connManager.setMobileDataEnabled(false);
        // String strData = connManager.getMobileDataEnabled() ? 
        // mContext.getString(R.string.quick_settings_data_on_label) 
        // : mContext.getString(R.string.quick_settings_data_off_label); 
        // Toast.makeText(mContext, strData, Toast.LENGTH_SHORT).show(); 
    } 
Stop searching for code, let great code find you!  Add Codota to your java IDE