Android saves WIFI details into WifiConfiguration class. When WIFI is ON and SSID, Pass-key details matches with WIFI network then Android auto connect with the particular WIFI Network. How to disable that auto-connect feature ? purpose behind asking this question is, I have two configured networks (already saved) and i want to connect WIFI on the button click event, but auto connect feature of android connects with the WIFI itself.
No. You cannot do this. The OS keeps track of the networks which are configured in the device. It tries to find those networks and based on the priority driven method, chooses an appropriate network and connects to it as soon as WiFi is turned on. As Arpit suggested, you can forget those networks and OS will remove it's configuration from memory.
If connection optimizer option does not shown in your phone then go to setting > Location access and disable the wifi and mobile network location or you can try the second method Download the wifi matic application from google play store it will prevent you from automatic wifi turning on.
My Samsung S7 can do this since the Android 7 update.
1) Get an instance of class WifiManager by calling Context.getSystemService(Context.WIFI_SERVICE).
2) Enable or disable Wifi using wifimanager.setWifiEnabled(true); and wifimanager.setWifiEnabled(false); respectively.
public void DisableWiFi(){
wifimanager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
wifimanager.setWifiEnabled(false);
}
required permissions
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
or
To stop your Android device from auto-connecting to open networks, open the settings and go to Network & Internet > Wi-Fi > Wi-Fi preferences. Tap the button next to Connect to open networks to disable it.
Note :This is confirmed to work in Android 10 Q for Pixel, but might work in older versions of Android, too. If you don't see these specific screens, look through Settings for something like Mobile Networks or Connections.
Since Android 11 each saved WiFi profile has an option to disable connecting automatically.
There's a way for your android to not auto-connect. The trick is to press & hold the connected network to modify it, then enter a hexa password. I.e. a password that is hexa or either characters or 8 numbers long or a combination then save the password.
When you try to re-connect the next time it will say "authentication problem"
Go to Menu - Settings - More Settings - Mobile Networks - Connection Optimizer and uncheck Sprint Connection Optimizer.
You have to do one thing in your device that just go to setting -> network setting -> WiFI and just click on the network listed below and When dialog comes just click on forget.
now you will not be connected to that network automatically.
© 2022 - 2024 — McMap. All rights reserved.