Search code examples
androidsamsung-mobilecells

Getting neighboring cells information using android Samsung galaxy smartphones


My target is to get all neighboring cell towers information like cell id, cell lac and RSS values, I used the class telephonyManager.getNeighboringCellInfo() to get required information but it return null every time.

But, I succeeded to get the nearest single cell tower information which connected to mobile (i.e serving cell) using telephonyManager.getCellLocation().

I tried to fix this problem and searched on every thing related it, then we found that all samsung devices can not support telephonyManager.getNeighboringCellInfo() class and it does not apply on Samsung but its working on HTC and LG devices.

See this: https://code.google.com/p/android/issues/detail?id=24136

I need to apply it on Samsung Android devices and getting neighboring cells information. Can anyone tell me how I can do that?

Single cell code:

if (telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM) {
            cellLocation = (GsmCellLocation)telephonyManager.getCellLocation();
            if(cellLocation!=null){
                int cell_ID = cellLocation.getCid();
                int cell_psc= cellLocation.getPsc();
                int cell_lac =cellLocation.getLac();
                cell_info.setText("Cell_ID: "+ String.valueOf(cell_ID) +"\n"+"Cell_psc: "+ String.valueOf(cell_psc)+"\n"+
                        "Cell_lac: " +String.valueOf(cell_lac)+"\n"+cellLocation.toString());

            }
        }

neighboring cell code:

List<NeighboringCellInfo> neighboringCellInfos = telephonyManager.getNeighboringCellInfo();
        for(NeighboringCellInfo neighboringCellInfo : neighboringCellInfos)
        {
            neighboringCellInfo.getCid();
            neighboringCellInfo.getLac();
            neighboringCellInfo.getPsc();
            neighboringCellInfo.getNetworkType();
            neighboringCellInfo.getRssi();

            neibouring_cell_information.add(neighboringCellInfo.getCid()+"\n"+ neighboringCellInfo.getRssi());

        }
        Toast.makeText(getApplicationContext(),neibouring_cell_information +"ok" , Toast.LENGTH_LONG).show();

all added permissions:

    <uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>

Solution

  • It seems Samsung phones not supporting neighbor display. Please check this forum:

    http://www.finetopix.com/showthread.php?30787-G-NetTrack-Android-OS-Netmonitor/page2

    The developer of this app said that samsung chips not supporting commands for display neighbors.