1

I need to detect the current network type and based on which I can assume the possible speed

Based on this Detect if connection is wifi, 3G or EDGE in android?

I am already able to detect speed using the getSubtype() functions for 3G/2G

But for WIFI and BLUETOOTH?

I can detect bluetooth/WIFI using ConnectivityManager.TYPE_BLUETOOTH and ConnectivityManager.TYPE_WIFI

But is it possible to detect the possible speed with bluetooth and WIFI assuming it provides the internet source?

May be using the signal strength?

Community
  • 1
  • 1
Dickens A S
  • 3,824
  • 2
  • 22
  • 45
  • I am not sure that for WIFI and BLUETOOTH there is a subType() which can be used for speed detection – Dickens A S Jul 20 '15 at 14:42
  • I think you are right, my answer will only work for mobile: if info.getType() == ConnectivityManager.TYPE_MOBILE –  Jul 20 '15 at 14:44

1 Answers1

2

This will work for mobile connection (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