Reputation: 141
I have to set a priority for wifi configuration sothat I have to always connect to specified wifi network so that device ignores other available wifi in the region.
configuration.priority = 100000;
It is connecting to the last known connected wifi network and ignoring specified wifi network.
Upvotes: 5
Views: 9037
Reputation: 49
If you are trying to set priority for a particular Wifi Configuration, you must use
config.priority = value;
WifiManager.updateNetwork(config);
and you should use the below api after updating
WifiManager.saveConfiguration();
I was able to set priority for my configured network.
Note:
Upvotes: 2
Reputation: 71
I know this is probably a bit late, but I've been looking at the same thing, and apparently 99 999 is the highest value you can set, anything higher than that gets ignored From here
Upvotes: 0
Reputation: 6319
If I remember correctly, changes to pre-configured networks should be saved to make an effect.
addOrUpdateNetworkNative(WifiConfiguration config);
Upvotes: 0