Android code doing an un needed network lookup
Closed this issue · 0 comments
vanlooverenkoen commented
addNetwork(wifiConfiguration)
configuredNetworks.find { network ->
network.SSID == wrapWithDoubleQuotes(ssid)
}?.let { network ->
disconnect()
enableNetwork(network.networkId, true)
reconnect()
result.success(true)
} ?: let {
result.success(false)
}
Can be:
var networkId = addNetwork(wifiConfiguration)
if (networkId == null) {
result.success(false)
return;
}
disconnect()
enableNetwork(networkId, true)
reconnect()
result.success(true)