WifiManager removeNetwork - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for WifiManager removeNetwork method.

This code example shows how to use the following methods:addNetwork, enableNetwork, removeNetwork, saveConfiguration
   */ 
  private static void updateNetwork(WifiManager wifiManager, WifiConfiguration config) {
    Integer foundNetworkID = findNetworkInExistingConfig(wifiManager, config.SSID);
    if (foundNetworkID != null) {
      Log.i(TAG, "Removing old configuration for network " + config.SSID);
      wifiManager.removeNetwork(foundNetworkID);
      wifiManager.saveConfiguration();
    } 
    int networkId = wifiManager.addNetwork(config);
    if (networkId >= 0) {
      // Try to disable the current network and start a new one. 
      if (wifiManager.enableNetwork(networkId, true)) {
        Log.i(TAG, "Associating to network " + config.SSID);
        wifiManager.saveConfiguration();
      } else { 
        Log.w(TAG, "Failed to enable network " + config.SSID);
      } 
    } else { 
      Log.w(TAG, "Unable to add network " + config.SSID);
    } 
5
CodeRank
This code example shows how to use the following methods:disconnect, removeNetwork
	} 
 
	private int doError(int resource_string) {
		statusView.setText(resource_string);
		// Give up on the connection 
		wifiManager.disconnect();
		if (networkId > 0) {
			wifiManager.removeNetwork(networkId);
			networkId = -1;
		} 
		if (receiverRegistered) {
			unregisterReceiver(wifiReceiver);
			receiverRegistered = false;
		} 
		return -1; 
	} 
 
	private WifiConfiguration changeNetworkCommon(NetworkSetting input) {
		statusView.setText(R.string.wifi_creating_network);
		Log.d(TAG, "Adding new configuration: \nSSID: " + input.getSsid()
4
CodeRank
This code example shows how to use the following methods:disconnect, removeNetwork
    } 
 
    private int doError(int resource_string) {
        statusView.setText(resource_string);
        // Give up on the connection 
        wifiManager.disconnect();
        if (networkId > 0) {
            wifiManager.removeNetwork(networkId);
            networkId = -1;
        } 
        if (receiverRegistered) {
            unregisterReceiver(wifiReceiver);
            receiverRegistered = false;
        } 
        return -1; 
    } 
 
    private WifiConfiguration changeNetworkCommon(NetworkSetting input) {
        statusView.setText(R.string.wifi_creating_network);
        Log.d(TAG, "Adding new configuration: \nSSID: " + input.getSsid() + "\nType: " +
4
CodeRank
This code example shows how to use the following methods:disconnect, removeNetwork
  } 
 
  private int doError(int resource_string) {
    statusView.setText(resource_string);
    // Give up on the connection 
    wifiManager.disconnect();
    if (networkId > 0) {
      wifiManager.removeNetwork(networkId);
      networkId = -1;
    } 
    if (receiverRegistered) {
      unregisterReceiver(wifiReceiver);
      receiverRegistered = false;
    } 
    return -1; 
  } 
 
  private WifiConfiguration changeNetworkCommon(NetworkSetting input){
    statusView.setText(R.string.wifi_creating_network);
    Log.d(TAG, "Adding new configuration: \nSSID: " + input.getSsid() + "\nType: " + input.getNetworkType());
5
CodeRank
This code example shows how to use the following methods:disconnect, removeNetwork
  } 
 
  private int doError(int resource_string) {
    statusView.setText(resource_string);
    // Give up on the connection 
    wifiManager.disconnect();
    if (networkId > 0) {
      wifiManager.removeNetwork(networkId);
      networkId = -1;
    } 
    if (receiverRegistered) {
      unregisterReceiver(wifiReceiver);
      receiverRegistered = false;
    } 
    return -1; 
  } 
 
  private WifiConfiguration changeNetworkCommon(NetworkSetting input){
    statusView.setText(R.string.wifi_creating_network);
    Log.d(TAG, "Adding new configuration: \nSSID: " + input.getSsid() + "\nType: " +
4
CodeRank
This code example shows how to use the following methods:disconnect, removeNetwork
		vmvideo_server_id = mWifiManager.addNetwork(wc);
		mWifiManager.enableNetwork(vmvideo_server_id, true);
	} 
 
	public void DisableVmvideo() { 
		mWifiManager.disconnect();
		mWifiManager.removeNetwork(vmvideo_server_id);
	} 
 
	/* Listen the wifi state */ 
	public class ConnectionChangeReceiver extends BroadcastReceiver {
		@Override 
		public void onReceive(Context context, Intent intent) {
			// TODO Auto-generated method stub 
			ConnectivityManager mConnectivityManager = (ConnectivityManager) context
					.getSystemService(Context.CONNECTIVITY_SERVICE);
			NetworkInfo ni = mConnectivityManager.getActiveNetworkInfo();
			if (ni.isConnected()) {
				Log.e("my_wifi", "established");
			} 
4
CodeRank
This code example shows how to use the following methods:disconnect, removeNetwork
  } 
 
  private int doError(int resource_string) {
    statusView.setText(resource_string);
    // Give up on the connection 
    wifiManager.disconnect();
    if (networkId > 0) {
      wifiManager.removeNetwork(networkId);
      networkId = -1;
    } 
    if (receiverRegistered) {
      unregisterReceiver(wifiReceiver);
      receiverRegistered = false;
    } 
    return -1; 
  } 
 
  private WifiConfiguration changeNetworkCommon(NetworkSetting input){
    statusView.setText(R.string.wifi_creating_network);
    Log.d(TAG, "Adding new configuration: \nSSID: " + input.getSsid() + "\nType: " +
4
CodeRank
This code example shows how to use the following methods:disconnect, removeNetwork
  } 
 
  private int doError(int resource_string) {
    statusView.setText(resource_string);
    // Give up on the connection 
    wifiManager.disconnect();
    if (networkId > 0) {
      wifiManager.removeNetwork(networkId);
      networkId = -1;
    } 
    if (receiverRegistered) {
      unregisterReceiver(wifiReceiver);
      receiverRegistered = false;
    } 
    return -1; 
  } 
 
  private WifiConfiguration changeNetworkCommon(NetworkSetting input){
    statusView.setText(R.string.wifi_creating_network);
    Log.d(TAG, "Adding new configuration: \nSSID: " + input.getSsid() + "\nType: " + input.getNetworkType());
5
CodeRank
This code example shows how to use the following methods:disconnect, removeNetwork
  } 
 
  private int doError(int resource_string) {
    statusView.setText(resource_string);
    // Give up on the connection 
    wifiManager.disconnect();
    if (networkId > 0) {
      wifiManager.removeNetwork(networkId);
      networkId = -1;
    } 
    if (receiverRegistered) {
      unregisterReceiver(wifiReceiver);
      receiverRegistered = false;
    } 
    return -1; 
  } 
 
  private WifiConfiguration changeNetworkCommon(NetworkSetting input){
    statusView.setText(R.string.wifi_creating_network);
    Log.d(TAG, "Adding new configuration: \nSSID: " + input.getSsid() + "\nType: " +
4
CodeRank
This code example shows how to use the following methods:removeNetwork, saveConfiguration
        		 
            	// removing from the know networks 
        		if (networkAutoForget == true)
        		{ 
	        		WifiManager wifiMgr = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
	            	wifiMgr.removeNetwork(freeWifiNetworkID);
	            	wifiMgr.saveConfiguration();
        		} 
        		 
	    		Toast toast = Toast.makeText(context.getApplicationContext(), "DELETED FREEWIFI NETWORK", Toast.LENGTH_LONG);
	    		toast.show();
	            	 
            	// deleting the freeWifiId 
    			Editor pName = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()).edit();
    		    pName.putInt("freeWifiNetworkID", 0);
    		    pName.commit();
            	 
            	Log.v(TAG, "Deleted freewifi ID: "+ freeWifiNetworkID );
        	} 
 
4
CodeRank

Related WifiManager removeNetwork Questions & Answers:

removeNetwork Method Overview
Remove the specified network from the list of configured networks.
See Code Examples for other Android WifiManager Methods: