I have had a good search around and experimented with various answers I'v seen for this but none of them appear to work in my case. I'm looking for a robust solution, so, with out further ado;
I have an unusual case where my app needs to connect to a wifi network that has no internet connectivity to perform some tasks (local network), once this is complete, it needs to drop the connection and reconnect to an alternative network, either mobile, or alternative wifi hotspot that DOES has internet connectivity so that I can do comms.
The problem I have is that my comms queue needs to make sure it actually has a route to the internet when it's about to start doing comms (which are triggered on a connectivity change)
I have tried various calls on ConnectivityManager such as;
isConnected();
isAvailable();
but these return true even when connected to my non-internet capable network.
I need a way of making sure that when connected to my non-internet capable network (or any other non-internet capable network such as a BT Openzone, when not registered and logged in for example) I can be told that there is not route to the internet, and then when I do have a route, I can return a true.
One possibility I considered was a ping, but if possible I'd prefer something a little neater.
I tried requestRouteToHost() but that doesn't do what I expected it to and in fact attempts to change connectivity, which is not what I want.
Thanks