Code example for ConnectivityManager

Methods: setMobileDataEnabled

0
        // 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(); 
    } 
 
    @Override 
    public boolean onLongClick(View v) {
        Intent intent = new Intent(
                android.provider.Settings.ACTION_DATA_ROAMING_SETTINGS);
        startActivity(intent);
        return super.onLongClick(v);
    } 
 
    private static int getCurrentPreferredNetworkMode(Context context) {