Question

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"/>
Was it helpful?

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.

OTHER TIPS

As @Ayman said most of samsung phones and also some other phones not support getNeigbouringCells()

The cellid implementation varies from mobile device to mobile device since these features are considered to be optional. for example:

Samsung (all devices): getNeigbouringCells () is not supported at all and always returns an empty list.

according to this: http://wiki.opencellid.org/wiki/Android_library

and this:

https://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&groupby=&sort=&id=24306

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top