Android network type detection and connection speed estimation
I need to determine the current network type and based on which I can guess the possible speed
Based on this Detecting if wifi, 3G or EDGE connection in android?
I can already determine the speed using the getSubtype () functions for 3G / 2G
But for WIFI and BLUETOOTH?
I can detect bluetooth / WIFI using ConnectivityManager.TYPE_BLUETOOTH
andConnectivityManager.TYPE_WIFI
But is it possible to determine the possible speed using bluetooth and WIFI, assuming it provides an internet source?
Could there be a signal strength?
+3
source to share
1 answer
This will work for mobile connectivity (info.getType () == ConnectivityManager.TYPE_MOBILE)
ConnectivityManager cm = (ConnectivityManager) mContext
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info = cm.getActiveNetworkInfo();
Integer subType = info.getSubtype();
switch (subType) {
case TelephonyManager.NETWORK_TYPE_1xRTT:
return "50-100 kbps";
case TelephonyManager.NETWORK_TYPE_CDMA:
return "14-64 kbps";
case TelephonyManager.NETWORK_TYPE_UMTS:
return "400-7000 kbps";
NETWORK_TYPE_1xRTT = ~ 50-100 kbps
NETWORK_TYPE_CDMA = ~ 14-64 kbps
NETWORK_TYPE_EDGE = ~ 50-100 kbps
NETWORK_TYPE_EVDO_0 = ~ 400-1000 kbps
NETWORK_TYPE_EVDO_A = ~ 600-1400 kbps
NETWORK_TYPE_GPRS = ~ 100 kbps
NETWORK_TYPE_HSDPA = ~ 2-14 Mbps
NETWORK_TYPE_HSPA = ~ 700-1700 kbps
NETWORK_TYPE_HSUPA = ~ 1-23 Mbps
NETWORK_TYPE_UMTS = ~ 400-7000 kbps
NETWORK_TYPE_EHRPD = ~ 1-2 Mbps
NETWORK_TYPE_EVDO_B = ~ 5 Mbps
NETWORK_TYPE_HSPAP = ~ 10-20 Mbps
NETWORK_TYPE_IDEN = ~ 25 kbps
NETWORK_TYPE_LTE = ~ 10+ Mbps
+2
source to share