Reputation: 423
I would like to know the type of connectivity to a host on android. More precisely, for example, I would like to know if the connection established to whatever.com is running through the wifi or the mobile connection.
Thanks.
Upvotes: 0
Views: 34
Reputation: 3561
If the Wifi is turned on it will always be used instead of mobile connectivity. Therefore, you can use Android's ConnectivityManager.getActiveNetworkInfo()
method to get the current active network interface. When Android switches between interfaces connections are broken, so a connection to any host can only be made using the active interface.
Upvotes: 1