Robin Dijkhof
Robin Dijkhof

Reputation: 19278

Android how to get supported network types

I read many posts about getting the current network type, but i'm interested in all supported network types. Is there a way to get them?

Upvotes: 0

Views: 252

Answers (1)

kandroidj
kandroidj

Reputation: 13922

ConnectivityManager has methods for this

ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);

for (NetworkInfo network : connectivityManager.getAllNetworkInfo()) {
    Log.d("Network", "network info: " + network.getType() + " " + network.getTypeName());
}

see http://developer.android.com/reference/android/net/ConnectivityManager.html#getAllNetworkInfo()

Returns connection status information about all network types supported by the device.

Also add to manifest <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

Upvotes: 1

Related Questions