I try get a list of available networks, but when WiFi is on I see only "WIFI," although GSM/LTE is enabled. Is there a good way to get the list available networks?
I'm trying to do so:
ConnectivityManager connManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
String strNetworkName = "";
if(null != connManager) {
Network networks[] = connManager.getAllNetworks();
if(networks != null) {
NetworkInfo nwInfo = null;
for(Network nw: networks) {
nwInfo = connManager.getNetworkInfo(nw);
strNetworkName += nwInfo.getTypeName() + ", ";
}
}
}
Toast.makeText(getApplicationContext(), strNetworkName, Toast.LENGTH_SHORT).show();