views:

478

answers:

2

How can I determine the current internet connection type available to an Android device? e.g. have it return WiFi, 3G, none.

+2  A: 

Use android.net.ConnectivityManager, specifically getActiveNetworkInfo(). You can see a somewhat-related example snippet here.

CommonsWare
A: 

You can also use the TelephonyManager to find out what the mobile network type is:

TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
int networkType = telephonyManager.getNetworkType();

Possible network types are listed at http://developer.android.com/reference/android/telephony/TelephonyManager.html#NETWORK%5FTYPE%5F1xRTT

AshtonBRSC