Information has been extracted from
TelephonyManager. TelephonyManager provides access to information
about the telephony services on the device. Applications can use the
methods in this class to determine telephony services and states, as
well as to access some types of subscriber information
public static int[] getCellInfo() { // VARs int[] oRes = new int[5]; Context oContext = Globals.m_oContext; TelephonyManager oTelManager = (TelephonyManager)oContext.getSystemService(Context.TELEPHONY_SERVICE); try { // Retrieve MCC and MNC String sMCC_MNC = oTelManager.getNetworkOperator(); if ( (sMCC_MNC != null) && (sMCC_MNC.length() >= 5) ) // It contains numeric name (MCC+MNC) of current registered operator { oRes[1] = Integer.parseInt(sMCC_MNC.substring(0, 3)); oRes[2] = Integer.parseInt(sMCC_MNC.substring(3)); } // Retrieve LAC and CellID CellLocation oCell = oTelManager.getCellLocation(); if (oCell instanceof GsmCellLocation) { oRes[3] = ((GsmCellLocation)oCell).getLac(); oRes[4] = ((GsmCellLocation)oCell).getCid(); } } catch (Exception e) { } return oRes; } }