ThanosFisherman / WifiUtils

Easily Connect to WiFi Networks
Apache License 2.0
744 stars 188 forks source link

Disconnect from connected network without disabling Wi-Fi? #50

Closed fartem closed 4 years ago

fartem commented 4 years ago

How can I disconnect from a connected network without disabling Wi-Fi?

Right now I'm disconnecting with default SDK methods:

WifiManager wifiManager = (WifiManager) getApplicationContext().getSystemService(
    Context.WIFI_SERVICE
);
wifiManager.disconnect();
NizarETH commented 4 years ago

me too I do the same :/

fartem commented 4 years ago

And wifiManager.disconnect(); not working on Android Q.

CloseFile commented 4 years ago

I use a trick in my app. When you need to disconnect just reconnect with wrong password.

ThanosFisherman commented 4 years ago

Future versions will include a disconnect feature. For now use the workaround mentioned by @CloseFile above or the standard wifiManager.disconnect()

fartem commented 4 years ago

@ThanosFisherman thanks!