1

This is my code, The return value is always false. I have 'Location' permission enabled. i am using this code to programatically connect to a different network(OPEN)[code is not given here. I am using enableNetwork() and reconnect()]. But, then phone automatically connects back to the previous network. This issue is observed in google pixel, v8.1.0. I have checked in android v7. works fine.

    WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
                List<WifiConfiguration> configurations = wifiManager.getConfiguredNetworks();
                for (WifiConfiguration config : configurations) {
                    Log.d("bhargav","SSID "+config.SSID);
//here it always returns false.
                        LibreLogger.d(this,"Disabling "+config.SSID+", result -> "+wifiManager.disableNetwork(config.networkId));

                }
  • 1
    from doc: *Applications are not allowed to disable networks created by other applications.* - are you sure that your app created this network? – Selvin Jun 07 '18 at 12:18
  • Selvin,i am using this code to programatically connect to a different network(OPEN). But, then phone automatically connects back to the previous network. So, i thought disabling network will solve the issue. – Bhargav Kumar Jun 07 '18 at 12:23

1 Answers1

1

When attempting to disable networks external to the application on Oreo the following error is prompted:

E/WifiConfigManager: UID XXXX does not have permission to update configuration "SSID"

Check these answers for more details.

randomuser
  • 603
  • 4
  • 16