I\'ve been trying to retrive the current network type, but no success
when i say network type: i refer to know this info:
if the type is: NETWORK_TYPE_IDEN
Better use would be:
NetworkInfo activeNetworkInfo = ((ConnectivityManager) activity.getSystemService(Context.CONNECTIVITY_SERVICE)).getActiveNetworkInfo();
if (activeNetworkInfo == null) return false;
switch (activeNetworkInfo.getType()) {
case ConnectivityManager.TYPE_WIFI:
return true;
}
// public static final int TYPE_BLUETOOTH = 7;
// public static final int TYPE_DUMMY = 8;
// public static final int TYPE_ETHERNET = 9;
// public static final int TYPE_MOBILE = 0;
// public static final int TYPE_MOBILE_DUN = 4;
// /** @deprecated */
// @Deprecated
// public static final int TYPE_MOBILE_HIPRI = 5;
// /** @deprecated */
// @Deprecated
// public static final int TYPE_MOBILE_MMS = 2;
// /** @deprecated */
// @Deprecated
// public static final int TYPE_MOBILE_SUPL = 3;
// public static final int TYPE_VPN = 17;
// public static final int TYPE_WIFI = 1;
// public static final int TYPE_WIMAX = 6;
Which other types you want to define and handle is up to you...
For those wanting a string identifier, better use:
activeNetworkInfo.getTypeName()
activeNetworkInfo.getSubtypeName()