Example usage for android.telephony TelephonyManager getNeighboringCellInfo

List of usage examples for android.telephony TelephonyManager getNeighboringCellInfo

Introduction

In this page you can find the example usage for android.telephony TelephonyManager getNeighboringCellInfo.

Prototype

@Deprecated
@RequiresPermission(android.Manifest.permission.ACCESS_COARSE_LOCATION)
public List<NeighboringCellInfo> getNeighboringCellInfo() 

Source Link

Document

Returns the neighboring cell information of the device.

Usage

From source file:Main.java

public static void getScanWifiResults(Context context) {
    WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
    List<ScanResult> wifiResults = wifiManager.getScanResults();
    for (ScanResult wifi : wifiResults) {
        //         LogUtil.log(TAG, Log.DEBUG, wifi.toString());
    }/*from w  ww.j  a  v a 2 s  .c  om*/

    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);

    //      LogUtil.log(TAG, Log.DEBUG, TelephonyManager.PHONE_TYPE_GSM + "----" + tm.getPhoneType());
    List<NeighboringCellInfo> cellResults = tm.getNeighboringCellInfo();
    for (NeighboringCellInfo cell : cellResults) {
        //         LogUtil.log(TAG, Log.DEBUG, cell.getCid() + "-" + cell.getLac() + "-" + cell.getRssi() + "-" + cell.getPsc()
        //               + "-" + cell.getNetworkType());
    }

    //      LogUtil.log(TAG, Log.DEBUG, getProviderName(context).getText());
}

From source file:com.google.android.gms.location.sample.geofencing.MainActivity.java

public void GetID() {

    List<NeighboringCellInfo> neighCell = null;
    TelephonyManager telManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
    neighCell = telManager.getNeighboringCellInfo();
    for (int i = 0; i < neighCell.size(); i++) {
        try {//from  w w w .j a v  a2 s  . c o  m
            NeighboringCellInfo thisCell = neighCell.get(i);
            int thisNeighCID = thisCell.getCid();
            int thisNeighRSSI = thisCell.getRssi();
            Log.i("Info:", " cid:" + thisNeighCID + " - " + thisNeighRSSI);
        } catch (NumberFormatException e) {
            e.printStackTrace();
            NeighboringCellInfo thisCell = neighCell.get(i);
            Log.i("exception", neighCell.toString());
        }
    }
    String networkOperator = telManager.getNetworkOperator();
    String mcc = "not avl", mnc = "not avl";
    if (networkOperator != null) {
        mcc = networkOperator.substring(0, 3);
        mnc = networkOperator.substring(3);
    }
    Log.i("", "mcc:" + mcc);
    Log.i("", "mnc:" + mnc);
}

From source file:fr.inria.ucn.collectors.NetworkStateCollector.java

@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
private JSONObject getMobile(TelephonyManager tm) throws JSONException {
    JSONObject mob = new JSONObject();

    mob.put("call_state", tm.getCallState());
    mob.put("data_activity", tm.getDataActivity());
    mob.put("network_type", tm.getNetworkType());
    mob.put("network_type_str", Helpers.getTelephonyNetworkType(tm.getNetworkType()));
    mob.put("phone_type", tm.getPhoneType());
    mob.put("phone_type_str", Helpers.getTelephonyPhoneType(tm.getPhoneType()));
    mob.put("sim_state", tm.getSimState());
    mob.put("network_country", tm.getNetworkCountryIso());
    mob.put("network_operator", tm.getNetworkOperator());
    mob.put("network_operator_name", tm.getNetworkOperatorName());

    // current cell location
    CellLocation cl = tm.getCellLocation();
    if (cl != null) {
        JSONObject loc = new JSONObject();
        if (cl instanceof GsmCellLocation) {
            JSONObject cell = new JSONObject();
            cell.put("cid", ((GsmCellLocation) cl).getCid());
            cell.put("lac", ((GsmCellLocation) cl).getLac());
            cell.put("psc", ((GsmCellLocation) cl).getPsc());
            loc.put("gsm", cell);
        } else if (cl instanceof CdmaCellLocation) {
            JSONObject cell = new JSONObject();
            cell.put("bs_id", ((CdmaCellLocation) cl).getBaseStationId());
            cell.put("bs_lat", ((CdmaCellLocation) cl).getBaseStationLatitude());
            cell.put("bs_lon", ((CdmaCellLocation) cl).getBaseStationLongitude());
            cell.put("net_id", ((CdmaCellLocation) cl).getNetworkId());
            cell.put("sys_id", ((CdmaCellLocation) cl).getSystemId());
            loc.put("cdma", cell);
        }// www  .j a  v  a2  s  . c  o  m
        mob.put("cell_location", loc);
    }

    // Cell neighbors
    List<NeighboringCellInfo> ncl = tm.getNeighboringCellInfo();
    if (ncl != null) {
        JSONArray cells = new JSONArray();
        for (NeighboringCellInfo nc : ncl) {
            JSONObject jnc = new JSONObject();
            jnc.put("cid", nc.getCid());
            jnc.put("lac", nc.getLac());
            jnc.put("network_type", nc.getNetworkType());
            jnc.put("network_type_str", Helpers.getTelephonyNetworkType(nc.getNetworkType()));
            jnc.put("psc", nc.getPsc());
            jnc.put("rssi", nc.getRssi());
            cells.put(jnc);
        }
        mob.put("neigh_cells", cells);
    }

    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
        // only works for API level >=17
        List<CellInfo> aci = (List<CellInfo>) tm.getAllCellInfo();
        if (aci != null) {
            JSONArray cells = new JSONArray();
            for (CellInfo ci : aci) {
                JSONObject jci = new JSONObject();
                if (ci instanceof CellInfoGsm) {
                    CellInfoGsm cigsm = (CellInfoGsm) ci;
                    jci.put("is_registered", cigsm.isRegistered());
                    jci.put("type", "gsm");
                    jci.put("cid", cigsm.getCellIdentity().getCid());
                    jci.put("lac", cigsm.getCellIdentity().getLac());
                    jci.put("mcc", cigsm.getCellIdentity().getMcc());
                    jci.put("mnc", cigsm.getCellIdentity().getMnc());
                    jci.put("psc", cigsm.getCellIdentity().getPsc());

                    jci.put("asu_level", cigsm.getCellSignalStrength().getAsuLevel());
                    jci.put("level", cigsm.getCellSignalStrength().getLevel());
                    jci.put("dbm", cigsm.getCellSignalStrength().getDbm());

                } else if (ci instanceof CellInfoCdma) {
                    CellInfoCdma cicdma = (CellInfoCdma) ci;
                    jci.put("is_registered", cicdma.isRegistered());
                    jci.put("type", "cdma");
                    jci.put("bs_id", cicdma.getCellIdentity().getBasestationId());
                    jci.put("bs_lat", cicdma.getCellIdentity().getLatitude());
                    jci.put("bs_lon", cicdma.getCellIdentity().getLongitude());
                    jci.put("net_id", cicdma.getCellIdentity().getNetworkId());
                    jci.put("sys_id", cicdma.getCellIdentity().getSystemId());

                    jci.put("asu_level", cicdma.getCellSignalStrength().getAsuLevel());
                    jci.put("dbm", cicdma.getCellSignalStrength().getDbm());
                    jci.put("level", cicdma.getCellSignalStrength().getLevel());
                    jci.put("cdma_dbm", cicdma.getCellSignalStrength().getCdmaDbm());
                    jci.put("cdma_ecio", cicdma.getCellSignalStrength().getCdmaEcio());
                    jci.put("cdma_level", cicdma.getCellSignalStrength().getCdmaLevel());
                    jci.put("evdo_dbm", cicdma.getCellSignalStrength().getEvdoDbm());
                    jci.put("evdo_ecio", cicdma.getCellSignalStrength().getEvdoEcio());
                    jci.put("evdo_level", cicdma.getCellSignalStrength().getEvdoLevel());
                    jci.put("evdo_snr", cicdma.getCellSignalStrength().getEvdoSnr());

                } else if (ci instanceof CellInfoWcdma) {
                    CellInfoWcdma ciwcdma = (CellInfoWcdma) ci;
                    jci.put("is_registered", ciwcdma.isRegistered());
                    jci.put("type", "wcdma");
                    jci.put("cid", ciwcdma.getCellIdentity().getCid());
                    jci.put("lac", ciwcdma.getCellIdentity().getLac());
                    jci.put("mcc", ciwcdma.getCellIdentity().getMcc());
                    jci.put("mnc", ciwcdma.getCellIdentity().getMnc());
                    jci.put("psc", ciwcdma.getCellIdentity().getPsc());

                    jci.put("asu_level", ciwcdma.getCellSignalStrength().getAsuLevel());
                    jci.put("dbm", ciwcdma.getCellSignalStrength().getDbm());
                    jci.put("level", ciwcdma.getCellSignalStrength().getLevel());

                } else if (ci instanceof CellInfoLte) {
                    CellInfoLte cilte = (CellInfoLte) ci;
                    jci.put("is_registered", cilte.isRegistered());
                    jci.put("type", "lte");
                    jci.put("ci", cilte.getCellIdentity().getCi());
                    jci.put("mcc", cilte.getCellIdentity().getMcc());
                    jci.put("mnc", cilte.getCellIdentity().getMnc());
                    jci.put("pci", cilte.getCellIdentity().getPci());
                    jci.put("tac", cilte.getCellIdentity().getTac());

                    jci.put("asu_level", cilte.getCellSignalStrength().getAsuLevel());
                    jci.put("dbm", cilte.getCellSignalStrength().getDbm());
                    jci.put("level", cilte.getCellSignalStrength().getLevel());
                    jci.put("timing_adv", cilte.getCellSignalStrength().getTimingAdvance());

                }
                cells.put(jci);
            }
            mob.put("all_cells", cells);
        }
    }
    return mob;
}

From source file:com.landenlabs.all_devtool.NetFragment.java

public void updateList() {
    // Time today = new Time(Time.getCurrentTimezone());
    // today.setToNow();
    // today.format(" %H:%M:%S")
    Date dt = new Date();
    m_titleTime.setText(m_timeFormat.format(dt));

    boolean expandAll = m_list.isEmpty();
    m_list.clear();//from w  w w .j av  a  2s . c o  m

    // Swap colors
    int color = m_rowColor1;
    m_rowColor1 = m_rowColor2;
    m_rowColor2 = color;

    ActivityManager actMgr = (ActivityManager) getActivity().getSystemService(Context.ACTIVITY_SERVICE);

    try {
        String androidIDStr = Settings.Secure.getString(getContext().getContentResolver(),
                Settings.Secure.ANDROID_ID);
        addBuild("Android ID", androidIDStr);

        try {
            AdvertisingIdClient.Info adInfo = AdvertisingIdClient.getAdvertisingIdInfo(getContext());
            final String adIdStr = adInfo.getId();
            final boolean isLAT = adInfo.isLimitAdTrackingEnabled();
            addBuild("Ad ID", adIdStr);
        } catch (IOException e) {
            // Unrecoverable error connecting to Google Play services (e.g.,
            // the old version of the service doesn't support getting AdvertisingId).
        } catch (GooglePlayServicesNotAvailableException e) {
            // Google Play services is not available entirely.
        }

        /*
        try {
        InstanceID instanceID = InstanceID.getInstance(getContext());
        if (instanceID != null) {
            // Requires a Google Developer project ID.
            String authorizedEntity = "<need to make this on google developer site>";
            instanceID.getToken(authorizedEntity, GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
            addBuild("Instance ID", instanceID.getId());
        }
        } catch (Exception ex) {
        }
        */

        ConfigurationInfo info = actMgr.getDeviceConfigurationInfo();
        addBuild("OpenGL", info.getGlEsVersion());
    } catch (Exception ex) {
        m_log.e(ex.getMessage());
    }

    // --------------- Connection Services -------------
    try {
        ConnectivityManager connMgr = (ConnectivityManager) getActivity()
                .getSystemService(Context.CONNECTIVITY_SERVICE);
        final NetworkInfo netInfo = connMgr.getActiveNetworkInfo();
        if (netInfo != null) {
            Map<String, String> netListStr = new LinkedHashMap<String, String>();

            putIf(netListStr, "Available", "Yes", netInfo.isAvailable());
            putIf(netListStr, "Connected", "Yes", netInfo.isConnected());
            putIf(netListStr, "Connecting", "Yes", !netInfo.isConnected() && netInfo.isConnectedOrConnecting());
            putIf(netListStr, "Roaming", "Yes", netInfo.isRoaming());
            putIf(netListStr, "Extra", netInfo.getExtraInfo(), !TextUtils.isEmpty(netInfo.getExtraInfo()));
            putIf(netListStr, "WhyFailed", netInfo.getReason(), !TextUtils.isEmpty(netInfo.getReason()));
            if (Build.VERSION.SDK_INT >= 16) {
                putIf(netListStr, "Metered", "Avoid heavy use", connMgr.isActiveNetworkMetered());
            }

            netListStr.put("NetworkType", netInfo.getTypeName());
            if (connMgr.getAllNetworkInfo().length > 1) {
                netListStr.put("Available Networks:", " ");
                for (NetworkInfo netI : connMgr.getAllNetworkInfo()) {
                    if (netI.isAvailable()) {
                        netListStr.put(" " + netI.getTypeName(), netI.isAvailable() ? "Yes" : "No");
                    }
                }
            }

            if (netInfo.isConnected()) {
                try {
                    for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en
                            .hasMoreElements();) {
                        NetworkInterface intf = en.nextElement();
                        for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr
                                .hasMoreElements();) {
                            InetAddress inetAddress = enumIpAddr.nextElement();
                            if (!inetAddress.isLoopbackAddress()) {
                                if (inetAddress.getHostAddress() != null) {
                                    String ipType = (inetAddress instanceof Inet4Address) ? "IPv4" : "IPv6";
                                    netListStr.put(intf.getName() + " " + ipType, inetAddress.getHostAddress());
                                }
                                // if (!TextUtils.isEmpty(inetAddress.getHostName()))
                                //     listStr.put( "HostName", inetAddress.getHostName());
                            }
                        }
                    }
                } catch (Exception ex) {
                    m_log.e("Network %s", ex.getMessage());
                }
            }

            addBuild("Network...", netListStr);
        }
    } catch (Exception ex) {
        m_log.e("Network %s", ex.getMessage());
    }

    // --------------- Telephony Services -------------
    TelephonyManager telephonyManager = (TelephonyManager) getActivity()
            .getSystemService(Context.TELEPHONY_SERVICE);
    if (telephonyManager != null) {
        Map<String, String> cellListStr = new LinkedHashMap<String, String>();
        try {
            cellListStr.put("Version", telephonyManager.getDeviceSoftwareVersion());
            cellListStr.put("Number", telephonyManager.getLine1Number());
            cellListStr.put("Service", telephonyManager.getNetworkOperatorName());
            cellListStr.put("Roaming", telephonyManager.isNetworkRoaming() ? "Yes" : "No");
            cellListStr.put("Type", getNetworkTypeName(telephonyManager.getNetworkType()));

            if (Build.VERSION.SDK_INT >= 17) {
                if (telephonyManager.getAllCellInfo() != null) {
                    for (CellInfo cellInfo : telephonyManager.getAllCellInfo()) {
                        String cellName = cellInfo.getClass().getSimpleName();
                        int level = 0;
                        if (cellInfo instanceof CellInfoCdma) {
                            level = ((CellInfoCdma) cellInfo).getCellSignalStrength().getLevel();
                        } else if (cellInfo instanceof CellInfoGsm) {
                            level = ((CellInfoGsm) cellInfo).getCellSignalStrength().getLevel();
                        } else if (cellInfo instanceof CellInfoLte) {
                            level = ((CellInfoLte) cellInfo).getCellSignalStrength().getLevel();
                        } else if (cellInfo instanceof CellInfoWcdma) {
                            if (Build.VERSION.SDK_INT >= 18) {
                                level = ((CellInfoWcdma) cellInfo).getCellSignalStrength().getLevel();
                            }
                        }
                        cellListStr.put(cellName, "Level% " + String.valueOf(100 * level / 4));
                    }
                }
            }

            for (NeighboringCellInfo cellInfo : telephonyManager.getNeighboringCellInfo()) {
                int level = cellInfo.getRssi();
                cellListStr.put("Cell level%", String.valueOf(100 * level / 31));
            }

        } catch (Exception ex) {
            m_log.e("Cell %s", ex.getMessage());
        }

        if (!cellListStr.isEmpty()) {
            addBuild("Cell...", cellListStr);
        }
    }

    // --------------- Bluetooth Services (API18) -------------
    if (Build.VERSION.SDK_INT >= 18) {
        try {
            BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
            if (bluetoothAdapter != null) {

                Map<String, String> btListStr = new LinkedHashMap<String, String>();

                btListStr.put("Enabled", bluetoothAdapter.isEnabled() ? "yes" : "no");
                btListStr.put("Name", bluetoothAdapter.getName());
                btListStr.put("ScanMode", String.valueOf(bluetoothAdapter.getScanMode()));
                btListStr.put("State", String.valueOf(bluetoothAdapter.getState()));
                Set<BluetoothDevice> pairedDevices = bluetoothAdapter.getBondedDevices();
                // If there are paired devices
                if (pairedDevices.size() > 0) {
                    // Loop through paired devices
                    for (BluetoothDevice device : pairedDevices) {
                        // Add the name and address to an array adapter to show in a ListView
                        btListStr.put("Paired:" + device.getName(), device.getAddress());
                    }
                }

                BluetoothManager btMgr = (BluetoothManager) getActivity()
                        .getSystemService(Context.BLUETOOTH_SERVICE);
                if (btMgr != null) {
                    // btMgr.getAdapter().
                }
                addBuild("Bluetooth", btListStr);
            }

        } catch (Exception ex) {

        }
    }

    // --------------- Wifi Services -------------
    final WifiManager wifiMgr = (WifiManager) getContext().getApplicationContext()
            .getSystemService(Context.WIFI_SERVICE);

    if (wifiMgr != null && wifiMgr.isWifiEnabled() && wifiMgr.getDhcpInfo() != null) {

        if (mSystemBroadcastReceiver == null) {
            mSystemBroadcastReceiver = new SystemBroadcastReceiver(wifiMgr);
            getActivity().registerReceiver(mSystemBroadcastReceiver, INTENT_FILTER_SCAN_AVAILABLE);
        }

        if (ActivityCompat.checkSelfPermission(getContext(),
                Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
                || ActivityCompat.checkSelfPermission(getContext(),
                        Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
            if (wifiMgr.getScanResults() == null || wifiMgr.getScanResults().size() != mLastScanSize) {
                mLastScanSize = wifiMgr.getScanResults().size();
                wifiMgr.startScan();
            }
        }

        Map<String, String> wifiListStr = new LinkedHashMap<String, String>();
        try {
            DhcpInfo dhcpInfo = wifiMgr.getDhcpInfo();

            wifiListStr.put("DNS1", Formatter.formatIpAddress(dhcpInfo.dns1));
            wifiListStr.put("DNS2", Formatter.formatIpAddress(dhcpInfo.dns2));
            wifiListStr.put("Default Gateway", Formatter.formatIpAddress(dhcpInfo.gateway));
            wifiListStr.put("IP Address", Formatter.formatIpAddress(dhcpInfo.ipAddress));
            wifiListStr.put("Subnet Mask", Formatter.formatIpAddress(dhcpInfo.netmask));
            wifiListStr.put("Server IP", Formatter.formatIpAddress(dhcpInfo.serverAddress));
            wifiListStr.put("Lease Time(sec)", String.valueOf(dhcpInfo.leaseDuration));

            WifiInfo wifiInfo = wifiMgr.getConnectionInfo();
            if (wifiInfo != null) {
                wifiListStr.put("LinkSpeed Mbps", String.valueOf(wifiInfo.getLinkSpeed()));
                int numberOfLevels = 10;
                int level = WifiManager.calculateSignalLevel(wifiInfo.getRssi(), numberOfLevels + 1);
                wifiListStr.put("Signal%", String.valueOf(100 * level / numberOfLevels));
                if (Build.VERSION.SDK_INT >= 23) {
                    wifiListStr.put("MAC", getMacAddr());
                } else {
                    wifiListStr.put("MAC", wifiInfo.getMacAddress());
                }
            }

        } catch (Exception ex) {
            m_log.e("Wifi %s", ex.getMessage());
        }

        if (!wifiListStr.isEmpty()) {
            addBuild("WiFi...", wifiListStr);
        }

        try {
            if (ActivityCompat.checkSelfPermission(getContext(),
                    Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
                    || ActivityCompat.checkSelfPermission(getContext(),
                            Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
                List<ScanResult> listWifi = wifiMgr.getScanResults();
                if (listWifi != null && !listWifi.isEmpty()) {
                    int idx = 0;

                    for (ScanResult scanResult : listWifi) {
                        Map<String, String> wifiScanListStr = new LinkedHashMap<String, String>();
                        wifiScanListStr.put("SSID", scanResult.SSID);
                        if (Build.VERSION.SDK_INT >= 23) {
                            wifiScanListStr.put("  Name", scanResult.operatorFriendlyName.toString());
                            wifiScanListStr.put("  Venue", scanResult.venueName.toString());
                        }

                        //        wifiScanListStr.put("  BSSID ",scanResult.BSSID);
                        wifiScanListStr.put("  Capabilities", scanResult.capabilities);
                        //       wifiScanListStr.put("  Center Freq", String.valueOf(scanResult.centerFreq0));
                        //       wifiScanListStr.put("  Freq width", String.valueOf(scanResult.channelWidth));
                        wifiScanListStr.put("  Level, Freq",
                                String.format("%d, %d", scanResult.level, scanResult.frequency));
                        if (Build.VERSION.SDK_INT >= 17) {
                            Date wifiTime = new Date(scanResult.timestamp);
                            wifiScanListStr.put("  Time", wifiTime.toLocaleString());
                        }
                        addBuild(String.format("WiFiScan #%d", ++idx), wifiScanListStr);
                    }
                }
            }
        } catch (Exception ex) {
            m_log.e("WifiList %s", ex.getMessage());
        }

        try {
            List<WifiConfiguration> listWifiCfg = wifiMgr.getConfiguredNetworks();

            for (WifiConfiguration wifiCfg : listWifiCfg) {
                Map<String, String> wifiCfgListStr = new LinkedHashMap<String, String>();
                if (Build.VERSION.SDK_INT >= 23) {
                    wifiCfgListStr.put("Name", wifiCfg.providerFriendlyName);
                }
                wifiCfgListStr.put("SSID", wifiCfg.SSID);
                String netStatus = "";
                switch (wifiCfg.status) {
                case WifiConfiguration.Status.CURRENT:
                    netStatus = "Connected";
                    break;
                case WifiConfiguration.Status.DISABLED:
                    netStatus = "Disabled";
                    break;
                case WifiConfiguration.Status.ENABLED:
                    netStatus = "Enabled";
                    break;
                }
                wifiCfgListStr.put(" Status", netStatus);
                wifiCfgListStr.put(" Priority", String.valueOf(wifiCfg.priority));
                if (null != wifiCfg.wepKeys) {
                    //               wifiCfgListStr.put(" wepKeys", TextUtils.join(",", wifiCfg.wepKeys));
                }
                String protocols = "";
                if (wifiCfg.allowedProtocols.get(WifiConfiguration.Protocol.RSN))
                    protocols = "RSN ";
                if (wifiCfg.allowedProtocols.get(WifiConfiguration.Protocol.WPA))
                    protocols = protocols + "WPA ";
                wifiCfgListStr.put(" Protocols", protocols);

                String keyProt = "";
                if (wifiCfg.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.NONE))
                    keyProt = "none";
                if (wifiCfg.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.WPA_EAP))
                    keyProt = "WPA+EAP ";
                if (wifiCfg.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.WPA_PSK))
                    keyProt = "WPA+PSK ";
                wifiCfgListStr.put(" Keys", keyProt);

                if (wifiCfg.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.NONE)) {
                    // Remove network connections with no Password.
                    // wifiMgr.removeNetwork(wifiCfg.networkId);
                }

                addBuild("WiFiCfg #" + wifiCfg.networkId, wifiCfgListStr);
            }

        } catch (Exception ex) {
            m_log.e("Wifi Cfg List %s", ex.getMessage());
        }
    }

    if (expandAll) {
        // updateList();
        int count = m_list.size();
        for (int position = 0; position < count; position++)
            m_listView.expandGroup(position);
    }

    m_adapter.notifyDataSetChanged();
}