Android determines the user 2G and 3G and 4G mobile data network

  • 2020-11-30 08:32:22
  • OfStack

Doing Android App, to give the user the provincial traffic, in order to not provoked the wrath of the user, in order to better user experience, according to the user of the current network situation is needed to do some adjustments, 1 can also be in App setting module, allows users to choose their own, in 2 G G / 3/4 G network conditions, whether to allow the request 1 some data flow is larger.

Both TelephonyManager and ConnectivityManager provided by Android can obtain the NetworksInfo object. The type can be obtained by getType() to determine whether it is wifi or mobile. If it is mobile, the network type and name can be obtained by getSubType() and getSubTypeName() of the NetworksInfo object.

The network type and name are defined in the TelephonyManager class.


/** Network type is unknown */
public static final int NETWORK_TYPE_UNKNOWN = 0;
/** Current network is GPRS */
public static final int NETWORK_TYPE_GPRS = 1;
/** Current network is EDGE */
public static final int NETWORK_TYPE_EDGE = 2;
/** Current network is UMTS */
public static final int NETWORK_TYPE_UMTS = 3;
/** Current network is CDMA: Either IS95A or IS95B*/
public static final int NETWORK_TYPE_CDMA = 4;
/** Current network is EVDO revision 0*/
public static final int NETWORK_TYPE_EVDO_0 = 5;
/** Current network is EVDO revision A*/
public static final int NETWORK_TYPE_EVDO_A = 6;
/** Current network is 1xRTT*/
public static final int NETWORK_TYPE_1xRTT = 7;
/** Current network is HSDPA */
public static final int NETWORK_TYPE_HSDPA = 8;
/** Current network is HSUPA */
public static final int NETWORK_TYPE_HSUPA = 9;
/** Current network is HSPA */
public static final int NETWORK_TYPE_HSPA = 10;
/** Current network is iDen */
public static final int NETWORK_TYPE_IDEN = 11;
/** Current network is EVDO revision B*/
public static final int NETWORK_TYPE_EVDO_B = 12;
/** Current network is LTE */
public static final int NETWORK_TYPE_LTE = 13;
/** Current network is eHRPD */
public static final int NETWORK_TYPE_EHRPD = 14;
/** Current network is HSPA+ */
public static final int NETWORK_TYPE_HSPAP = 15;

If you look at this code and the comments, it's hard to understand if you don't know anything about it, what the hell? What's the difference between this comment and no comment? ! It's just more annoying to look at. So, comments are very important to the person reading the code. Of course these things may be too professional, the people who write this code probably want to write it but don't know what to do, how big a mess does it have to be? ! In the end, I will post some materials I have sorted out for your reference. 1. They are not very detailed or professional, but have a general impression.

TelephonyManager also provides the method getNetworkTypeName(int type), which returns 1 string, but not much information.

So how do you tell if it's 2G, 3G or 4G? TelephonyManager also provides another method, getNetworkClass(int networkType), but this method is hidden, so I'll post the code 1.


public static int getNetworkClass(int networkType) { 
switch (networkType) { 
case NETWORK_TYPE_GPRS: 
case NETWORK_TYPE_EDGE: 
case NETWORK_TYPE_CDMA: 
case NETWORK_TYPE_1xRTT: 
case NETWORK_TYPE_IDEN: 
return NETWORK_CLASS_2_G; 
case NETWORK_TYPE_UMTS: 
case NETWORK_TYPE_EVDO_0: 
case NETWORK_TYPE_EVDO_A: 
case NETWORK_TYPE_HSDPA: 
case NETWORK_TYPE_HSUPA: 
case NETWORK_TYPE_HSPA: 
case NETWORK_TYPE_EVDO_B: 
case NETWORK_TYPE_EHRPD: 
case NETWORK_TYPE_HSPAP: 
return NETWORK_CLASS_3_G; 
case NETWORK_TYPE_LTE: 
return NETWORK_CLASS_4_G; 
default: 
return NETWORK_CLASS_UNKNOWN; 
} 
} 

And then here are the values of these constants.


/** Unknown network class. {@hide} */ 
public static final int NETWORK_CLASS_UNKNOWN = 0; 
/** Class of broadly defined "2G" networks. {@hide} */ 
public static final int NETWORK_CLASS_2_G = 1; 
/** Class of broadly defined "3G" networks. {@hide} */ 
public static final int NETWORK_CLASS_3_G = 2; 
/** Class of broadly defined "4G" networks. {@hide} */ 
public static final int NETWORK_CLASS_4_G = 3; 

I don't know why you would want to hide this stuff. Or some other better way? ! I don't know, first of all, now through the above means, is to know what network users are using, but also can distinguish the user is using 2G, 3G or 4G. And of course, once you have that data, you can also figure out which company's network the user is using, mobile, Unicom, or Telecom, of course, only in China. And after the virtual operators start to go public, it is indistinguishable from JINGdong, Gome, Suning, but you can know your mobile phone number is using the Unicom network or the mobile network.

Finally, I will post some information I have collected for your reference.

GPRS 2G(2.5) General Packet Radia Service 114kbps EDGE 2G(2.75G) Enhanced Data Rate for GSM Evolution 384kbps UMTS 3G Universal Mobile Telecommunication System Complete mobile communication technology standard CDMA 2G Telecom Code Division Multiple Access Code division multiple access EVDO_0 3G (EVDO 2000 1ES75en-ES76en) ES77en-ES78en Only (Data Optimized) 153.6 ES82en-2.4 mbps belongs to 3G EVDO_A 3G 1.8 mbps-3.1 mbps belongs to the transition of 3G, 3.5G 1xRTT 2G CDMA2000 1xRTT (RTT - Radio transmission technology) 144kbps 2G transition, HSDPA 3.5G high-speed downlink packet access 3.5G WCDMA High Downlink Access 14.4mbps HSUPA 3.5G High Speed Uplink Packet Access High-speed uplink packet access 1.4-5.8 mbps HSPA 3G (HSDPA,HSUPA) High Speed Packet Access IDEN 2G Dispatch Enhanced Networks Integrated Digital Enhanced Network (owned by 2G, from Wikipedia) EVDO_B 3G ES135en-ES137en.B 14.7Mbps, 3.5G LTE 4ES143en Evolution FDD and ES148en-ES149en, 3G transition, the updated version of LTE Advanced is 4G An upgrade from EHRPD 3G CDMA2000 to LTE 4G intermediate Evolved High Rate Data HRPD HSPAP 3G HSPAP is faster than HSDPA

Example:


import java.io.BufferedReader; 
import java.io.InputStreamReader; 
import java.text.DecimalFormat; 
import java.util.List; 
  
import android.content.Context; 
import android.net.ConnectivityManager; 
import android.net.NetworkInfo; 
import android.net.wifi.WifiInfo; 
import android.net.wifi.WifiManager; 
import android.telephony.NeighboringCellInfo; 
import android.telephony.TelephonyManager; 
import android.telephony.cdma.CdmaCellLocation; 
import android.telephony.gsm.GsmCellLocation; 
import android.util.Log; 
  
public class NetWorkUtil { 
  
  public static boolean isWifiAvailable() { 
    ConnectivityManager connectivityManager = (ConnectivityManager) ConfigManager 
        .getContext().getSystemService(Context.CONNECTIVITY_SERVICE); 
    NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); 
    return (networkInfo != null && networkInfo.isConnected() && networkInfo 
        .getType() == ConnectivityManager.TYPE_WIFI); 
  } 
  
  /** 
   *  To obtain MAC address  
   * 
   * @param context 
   * @return 
   */ 
  public static String getMacAddress(Context context) { 
    if (context == null) { 
      return ""; 
    } 
  
    String localMac = null; 
    if (isWifiAvailable()) { 
      localMac = getWifiMacAddress(context); 
    } 
  
    if (localMac != null && localMac.length() > 0) { 
      localMac = localMac.replace(":", "-").toLowerCase(); 
      return localMac; 
    } 
  
    localMac = getMacFromCallCmd(); 
    if (localMac != null) { 
      localMac = localMac.replace(":", "-").toLowerCase(); 
    } 
  
    return localMac; 
  } 
  
  private static String getWifiMacAddress(Context context) { 
    String localMac = null; 
    try { 
      WifiManager wifi = (WifiManager) context 
          .getSystemService(Context.WIFI_SERVICE); 
      WifiInfo info = wifi.getConnectionInfo(); 
      if (wifi.isWifiEnabled()) { 
        localMac = info.getMacAddress(); 
        if (localMac != null) { 
          localMac = localMac.replace(":", "-").toLowerCase(); 
          return localMac; 
        } 
      } 
  
    } catch (Exception e) { 
      e.printStackTrace(); 
    } 
  
    return null; 
  } 
  
  /** 
   *  through callCmd("busybox ifconfig","HWaddr") To obtain mac address  
   * 
   * @attention  Equipment installation is required busybox tool  
   * @return Mac Address 
   */ 
  private static String getMacFromCallCmd() { 
    String result = ""; 
    result = callCmd("busybox ifconfig", "HWaddr"); 
  
    if (result == null || result.length() <= 0) { 
      return null; 
    } 
  
    DebugLog.v("tag", "cmd result : " + result); 
  
    //  This row is parsed  
    //  Such as: eth0 Link encap:Ethernet HWaddr 00:16:E8:3E:DF:67 
    if (result.length() > 0 && result.contains("HWaddr") == true) { 
      String Mac = result.substring(result.indexOf("HWaddr") + 6, 
          result.length() - 1); 
      if (Mac.length() > 1) { 
        result = Mac.replaceAll(" ", ""); 
      } 
    } 
  
    return result; 
  } 
  
  public static String callCmd(String cmd, String filter) { 
    String result = ""; 
    String line = ""; 
    try { 
      Process proc = Runtime.getRuntime().exec(cmd); 
      InputStreamReader is = new InputStreamReader(proc.getInputStream()); 
      BufferedReader br = new BufferedReader(is); 
  
      //  Execute the command cmd , only take the value contained in the result filter the 1 line  
      while ((line = br.readLine()) != null 
          && line.contains(filter) == false) { 
      } 
  
      result = line; 
    } catch (Exception e) { 
      e.printStackTrace(); 
    } 
    return result; 
  } 
  
  /** 
   *  Network availability  
   * 
   * @param context 
   * @return 
   */ 
  public static boolean IsNetWorkEnable(Context context) { 
    try { 
      ConnectivityManager connectivity = (ConnectivityManager) context 
          .getSystemService(Context.CONNECTIVITY_SERVICE); 
      if (connectivity == null) { 
        ToastUtil.showMessage(context, " Unable to connect to the network "); 
        return false; 
      } 
  
      NetworkInfo info = connectivity.getActiveNetworkInfo(); 
      if (info != null && info.isConnected()) { 
        //  Determine if the current network is connected  
        if (info.getState() == NetworkInfo.State.CONNECTED) { 
          return true; 
        } 
      } 
  
    } catch (Exception e) { 
      e.printStackTrace(); 
    } 
    ToastUtil.showMessage(context, " Unable to connect to the network "); 
    return false; 
  } 
  
  private static final int NETWORK_TYPE_UNAVAILABLE = -1; 
  // private static final int NETWORK_TYPE_MOBILE = -100; 
  private static final int NETWORK_TYPE_WIFI = -101; 
  
  private static final int NETWORK_CLASS_WIFI = -101; 
  private static final int NETWORK_CLASS_UNAVAILABLE = -1; 
  /** Unknown network class. */ 
  private static final int NETWORK_CLASS_UNKNOWN = 0; 
  /** Class of broadly defined "2G" networks. */ 
  private static final int NETWORK_CLASS_2_G = 1; 
  /** Class of broadly defined "3G" networks. */ 
  private static final int NETWORK_CLASS_3_G = 2; 
  /** Class of broadly defined "4G" networks. */ 
  private static final int NETWORK_CLASS_4_G = 3; 
  
  private static DecimalFormat df = new DecimalFormat("#.##"); 
  
  //  Compatible with lower - version phones  
  /** Network type is unknown */ 
  public static final int NETWORK_TYPE_UNKNOWN = 0; 
  /** Current network is GPRS */ 
  public static final int NETWORK_TYPE_GPRS = 1; 
  /** Current network is EDGE */ 
  public static final int NETWORK_TYPE_EDGE = 2; 
  /** Current network is UMTS */ 
  public static final int NETWORK_TYPE_UMTS = 3; 
  /** Current network is CDMA: Either IS95A or IS95B */ 
  public static final int NETWORK_TYPE_CDMA = 4; 
  /** Current network is EVDO revision 0 */ 
  public static final int NETWORK_TYPE_EVDO_0 = 5; 
  /** Current network is EVDO revision A */ 
  public static final int NETWORK_TYPE_EVDO_A = 6; 
  /** Current network is 1xRTT */ 
  public static final int NETWORK_TYPE_1xRTT = 7; 
  /** Current network is HSDPA */ 
  public static final int NETWORK_TYPE_HSDPA = 8; 
  /** Current network is HSUPA */ 
  public static final int NETWORK_TYPE_HSUPA = 9; 
  /** Current network is HSPA */ 
  public static final int NETWORK_TYPE_HSPA = 10; 
  /** Current network is iDen */ 
  public static final int NETWORK_TYPE_IDEN = 11; 
  /** Current network is EVDO revision B */ 
  public static final int NETWORK_TYPE_EVDO_B = 12; 
  /** Current network is LTE */ 
  public static final int NETWORK_TYPE_LTE = 13; 
  /** Current network is eHRPD */ 
  public static final int NETWORK_TYPE_EHRPD = 14; 
  /** Current network is HSPA+ */ 
  public static final int NETWORK_TYPE_HSPAP = 15; 
  
  /** 
   *  Formatted size  
   * 
   * @param size 
   * @return 
   */ 
  public static String formatSize(long size) { 
    String unit = "B"; 
    float len = size; 
    if (len > 900) { 
      len /= 1024f; 
      unit = "KB"; 
    } 
    if (len > 900) { 
      len /= 1024f; 
      unit = "MB"; 
    } 
    if (len > 900) { 
      len /= 1024f; 
      unit = "GB"; 
    } 
    if (len > 900) { 
      len /= 1024f; 
      unit = "TB"; 
    } 
    return df.format(len) + unit; 
  } 
  
  public static String formatSizeBySecond(long size) { 
    String unit = "B"; 
    float len = size; 
    if (len > 900) { 
      len /= 1024f; 
      unit = "KB"; 
    } 
    if (len > 900) { 
      len /= 1024f; 
      unit = "MB"; 
    } 
    if (len > 900) { 
      len /= 1024f; 
      unit = "GB"; 
    } 
    if (len > 900) { 
      len /= 1024f; 
      unit = "TB"; 
    } 
    return df.format(len) + unit + "/s"; 
  } 
  
  public static String format(long size) { 
    String unit = "B"; 
    float len = size; 
    if (len > 1000) { 
      len /= 1024f; 
      unit = "KB"; 
      if (len > 1000) { 
        len /= 1024f; 
        unit = "MB"; 
        if (len > 1000) { 
          len /= 1024f; 
          unit = "GB"; 
        } 
      } 
    } 
    return df.format(len) + "\n" + unit + "/s"; 
  } 
  
  /** 
   *  Acquisition operator  
   * 
   * @return 
   */ 
  public static String getProvider() { 
    String provider = " The unknown "; 
    try { 
      TelephonyManager telephonyManager = (TelephonyManager) ConfigManager 
          .getContext().getSystemService(Context.TELEPHONY_SERVICE); 
      String IMSI = telephonyManager.getSubscriberId(); 
      Log.v("tag", "getProvider.IMSI:" + IMSI); 
      if (IMSI == null) { 
        if (TelephonyManager.SIM_STATE_READY == telephonyManager 
            .getSimState()) { 
          String operator = telephonyManager.getSimOperator(); 
          Log.v("tag", "getProvider.operator:" + operator); 
          if (operator != null) { 
            if (operator.equals("46000") 
                || operator.equals("46002") 
                || operator.equals("46007")) { 
              provider = " China Mobile "; 
            } else if (operator.equals("46001")) { 
              provider = " China Unicom "; 
            } else if (operator.equals("46003")) { 
              provider = " China Telecom "; 
            } 
          } 
        } 
      } else { 
        if (IMSI.startsWith("46000") || IMSI.startsWith("46002") 
            || IMSI.startsWith("46007")) { 
          provider = " China Mobile "; 
        } else if (IMSI.startsWith("46001")) { 
          provider = " China Unicom "; 
        } else if (IMSI.startsWith("46003")) { 
          provider = " China Telecom "; 
        } 
      } 
    } catch (Exception e) { 
      e.printStackTrace(); 
    } 
    return provider; 
  } 
  
  /** 
   *  Get network type  
   * 
   * @return 
   */ 
  public static String getCurrentNetworkType() { 
    int networkClass = getNetworkClass(); 
    String type = " The unknown "; 
    switch (networkClass) { 
    case NETWORK_CLASS_UNAVAILABLE: 
      type = " There is no "; 
      break; 
    case NETWORK_CLASS_WIFI: 
      type = "Wi-Fi"; 
      break; 
    case NETWORK_CLASS_2_G: 
      type = "2G"; 
      break; 
    case NETWORK_CLASS_3_G: 
      type = "3G"; 
      break; 
    case NETWORK_CLASS_4_G: 
      type = "4G"; 
      break; 
    case NETWORK_CLASS_UNKNOWN: 
      type = " The unknown "; 
      break; 
    } 
    return type; 
  } 
  
  private static int getNetworkClassByType(int networkType) { 
    switch (networkType) { 
    case NETWORK_TYPE_UNAVAILABLE: 
      return NETWORK_CLASS_UNAVAILABLE; 
    case NETWORK_TYPE_WIFI: 
      return NETWORK_CLASS_WIFI; 
    case NETWORK_TYPE_GPRS: 
    case NETWORK_TYPE_EDGE: 
    case NETWORK_TYPE_CDMA: 
    case NETWORK_TYPE_1xRTT: 
    case NETWORK_TYPE_IDEN: 
      return NETWORK_CLASS_2_G; 
    case NETWORK_TYPE_UMTS: 
    case NETWORK_TYPE_EVDO_0: 
    case NETWORK_TYPE_EVDO_A: 
    case NETWORK_TYPE_HSDPA: 
    case NETWORK_TYPE_HSUPA: 
    case NETWORK_TYPE_HSPA: 
    case NETWORK_TYPE_EVDO_B: 
    case NETWORK_TYPE_EHRPD: 
    case NETWORK_TYPE_HSPAP: 
      return NETWORK_CLASS_3_G; 
    case NETWORK_TYPE_LTE: 
      return NETWORK_CLASS_4_G; 
    default: 
      return NETWORK_CLASS_UNKNOWN; 
    } 
  } 
  
  private static int getNetworkClass() { 
    int networkType = NETWORK_TYPE_UNKNOWN; 
    try { 
      final NetworkInfo network = ((ConnectivityManager) ConfigManager 
          .getContext() 
          .getSystemService(Context.CONNECTIVITY_SERVICE)) 
          .getActiveNetworkInfo(); 
      if (network != null && network.isAvailable() 
          && network.isConnected()) { 
        int type = network.getType(); 
        if (type == ConnectivityManager.TYPE_WIFI) { 
          networkType = NETWORK_TYPE_WIFI; 
        } else if (type == ConnectivityManager.TYPE_MOBILE) { 
          TelephonyManager telephonyManager = (TelephonyManager) ConfigManager 
              .getContext().getSystemService( 
                  Context.TELEPHONY_SERVICE); 
          networkType = telephonyManager.getNetworkType(); 
        } 
      } else { 
        networkType = NETWORK_TYPE_UNAVAILABLE; 
      } 
  
    } catch (Exception ex) { 
      ex.printStackTrace(); 
    } 
    return getNetworkClassByType(networkType); 
  
  } 
  
  public static String getWifiRssi() { 
    int asu = 85; 
    try { 
      final NetworkInfo network = ((ConnectivityManager) ConfigManager 
          .getContext() 
          .getSystemService(Context.CONNECTIVITY_SERVICE)) 
          .getActiveNetworkInfo(); 
      if (network != null && network.isAvailable() 
          && network.isConnected()) { 
        int type = network.getType(); 
        if (type == ConnectivityManager.TYPE_WIFI) { 
          WifiManager wifiManager = (WifiManager) ConfigManager 
              .getContext() 
              .getSystemService(Context.WIFI_SERVICE); 
  
          WifiInfo wifiInfo = wifiManager.getConnectionInfo(); 
          if (wifiInfo != null) { 
            asu = wifiInfo.getRssi(); 
          } 
        } 
      } 
    } catch (Exception e) { 
      e.printStackTrace(); 
    } 
    return asu + "dBm"; 
  } 
  
  public static String getWifiSsid() { 
    String ssid = ""; 
    try { 
      final NetworkInfo network = ((ConnectivityManager) ConfigManager 
          .getContext() 
          .getSystemService(Context.CONNECTIVITY_SERVICE)) 
          .getActiveNetworkInfo(); 
      if (network != null && network.isAvailable() 
          && network.isConnected()) { 
        int type = network.getType(); 
        if (type == ConnectivityManager.TYPE_WIFI) { 
          WifiManager wifiManager = (WifiManager) ConfigManager 
              .getContext() 
              .getSystemService(Context.WIFI_SERVICE); 
  
          WifiInfo wifiInfo = wifiManager.getConnectionInfo(); 
          if (wifiInfo != null) { 
            ssid = wifiInfo.getSSID(); 
            if (ssid == null) { 
              ssid = ""; 
            } 
            ssid = ssid.replaceAll("\"", ""); 
          } 
        } 
      } 
    } catch (Exception e) { 
      e.printStackTrace(); 
    } 
    return ssid; 
  } 
  
  /** 
   *  check sim The card status  
   * 
   * @param ctx 
   * @return 
   */ 
  public static boolean checkSimState() { 
    TelephonyManager tm = (TelephonyManager) ConfigManager.getContext() 
        .getSystemService(Context.TELEPHONY_SERVICE); 
    if (tm.getSimState() == TelephonyManager.SIM_STATE_ABSENT 
        || tm.getSimState() == TelephonyManager.SIM_STATE_UNKNOWN) { 
      return false; 
    } 
  
    return true; 
  } 
  
  /** 
   *  To obtain imei 
   */ 
  public static String getImei() { 
    TelephonyManager mTelephonyMgr = (TelephonyManager) ConfigManager 
        .getContext().getSystemService(Context.TELEPHONY_SERVICE); 
    String imei = mTelephonyMgr.getDeviceId(); 
    if (imei == null) { 
      imei = "000000000000000"; 
    } 
    return imei; 
  } 
  
  public static String getPhoneImsi() { 
    TelephonyManager mTelephonyMgr = (TelephonyManager) ConfigManager 
        .getContext().getSystemService(Context.TELEPHONY_SERVICE); 
    return mTelephonyMgr.getSubscriberId(); 
  } 
  
  public static CellInfo getNetInfo() { 
    CellInfo info = new CellInfo(); 
    try { 
      TelephonyManager mTelephonyManager = (TelephonyManager) ConfigManager 
          .getContext().getSystemService(Context.TELEPHONY_SERVICE); 
      String operator = mTelephonyManager.getNetworkOperator(); 
      if (operator != null) { 
        /**  through operator To obtain  MCC  and MNC */ 
        if (operator.length() > 3) { 
          String mcc = operator.substring(0, 3); 
          String mnc = operator.substring(3); 
          info.setMcc(mcc); 
          info.setMnc(mnc); 
        } 
      } 
  
      int lac = 0; 
      int cellId = 0; 
      int phoneType = mTelephonyManager.getPhoneType(); 
      if (phoneType == TelephonyManager.PHONE_TYPE_GSM) { 
        GsmCellLocation location = (GsmCellLocation) mTelephonyManager 
            .getCellLocation(); 
        /**  through GsmCellLocation Acquire China Mobile and China Unicom  LAC  and cellID */ 
        lac = location.getLac(); 
        cellId = location.getCid(); 
      } else if (phoneType == TelephonyManager.PHONE_TYPE_CDMA) { 
        CdmaCellLocation location = (CdmaCellLocation) mTelephonyManager 
            .getCellLocation(); 
        lac = location.getNetworkId(); 
        cellId = location.getBaseStationId(); 
        cellId /= 16; 
      } 
      if (lac == 0 || cellId == 0) { 
        List<NeighboringCellInfo> infos = mTelephonyManager 
            .getNeighboringCellInfo(); 
        int lc = 0; 
        int ci = 0; 
        int rssi = 0; 
        for (NeighboringCellInfo cell : infos) { 
          //  The cycle is based on the total number of adjacent areas  
          if (lc == 0 || ci == 0) { 
            lc = cell.getLac(); 
            ci = cell.getCid(); 
            rssi = cell.getRssi(); 
          } 
          // sb.append(" LAC : " + info.getLac()); 
          // //  Take out the current neighborhood LAC 
          // sb.append(" CID : " + info.getCid()); 
          // //  Take out the current neighborhood CID 
          // sb.append(" BSSS : " + (-113 + 2 * info.getRssi()) + 
          // "\n"); //  Obtain the signal strength of adjacent base station  
        } 
        rssi = -113 + 2 * rssi; 
      } 
    } catch (Exception e) { 
      e.printStackTrace(); 
    } 
    return info; 
  } 
  
}

I hope this article has been helpful in learning Android software programming.


Related articles: