Issue
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?
Solution
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"/>
Answered By - kandroidj
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.