When my app starts I want to check if the device is connected to a specific wifi, my current code looks like this
private boolean haveNetwork() {
boolean have_WIFI = false;
ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
NetworkInfo[] networkInfos = connectivityManager.getAllNetworkInfo();
for (NetworkInfo info:networkInfos) {
if (info.getTypeName().equalsIgnoreCase("WIFI" )) {
if (info.isConnected())
have_WIFI = true;
}
}
return have_WIFI;
}
But it only checks if the device has any WIFI connection at all. How would I modify it to check for a specific WIFI SSID e.g. "Home"?