Lollipop has a new feature which is causing a huge problem for me. The system will fall back, transparently, to Mobile data when the WiFi network is "connected" but has no internet. http://www.androidpolice.com/2014/10/18/lollipop-feature-spotlight-android-now-defaults-to-mobile-data-when-wi-fi-has-no-internet-access-signal-icon-adds-a-for-no-connection/
Since one of the apps I make for my company is a WiFi testing application, similar to Fing etc, this is causing issues in Lollipop. I NEED to send packets out on the bad WiFi signal, so that problems can be located and fixed, ex Traceroute, Ping etc. While external IP's may not work, internal IP addresses should still be reachable in a scenario like this. However with the connection automatically falling back to the mobile network this is not longer possible.
I have not yet found any solution to detecting this. NetworkInfo.getState()
and NetworkInfo.getDetailedState()
both report "DISCONNECTED" even though the WiFi is connected and just has a bad external connection. Does anyone have any suggestions? All research thus far has led me to believe I can't force packets over the WiFi connection in Android, and I haven't figured out if I can detect this state. Other than detecting if Mobile data is on, and asking the user to turn it off, what are my options?