I ran into the case that when I had 4G off and connected to certain wifi access point but without capability to send out or receive data, the flag used to check the connectivity of network was set to be true like below.
NetworkInfo ni = context.getActiveNetworkInfo();
boolean flag = ni.isConnected();
In this case, I should obviously drop the wifi and switch on my 4G or in other words turn to use my 4g instead of wifi network.
But How could I check the quality of wifi connectivity?
you can check the speed in the mobile network using this code,