cellID and LAC / PSC for 3G neighboring cells in Android
Asked Answered
B

3

8

I am trying to identify the neighboring cells location in 3G with Android, which I get with getNeighboringCellInfo(). When The phone works in GSM mode, I am able to use getCid() and getLac() to get the CellID and the LAC, but for 3G, I can only use getPsc(), which I'm not very sure if it's enough to identify a cell.

Can anybody please tell me if I can get the CellID + LAC for neighboring cells? And if that's not possible, how can I use the PSC code to identify a cell?

Bart answered 14/3, 2012 at 12:15 Comment(2)
Can you please tell me in which phone model & Android version you found getPsc() working? Appreciate it if you could reply.Pontic
I got the same problem, for the UTMS network, it just cant get the cellId and lac, but it works well with the current connected cell tower. I think it cant get the neighboring cellid for the current api level.Kangaroo
P
4

In UMTS, the PSC is a kind of local cell identifier. It is "locally" unique in that all neighboring cell, as well as all neighbors of these cells, are guaranteed to have a different PSC than the current cell. It also means that you will not ever encounter two neighboring cells with the same PSC. However, there may well be cells with the same PSC located in different parts of the country.

The NeighboringCellInfo for a UMTS cell will only have the PSC set while all other fields (MCC, MNC, LAC, CID) will be invalid. The only way to find out these parameters would be to store all fields (MCC, MNC, LAC, CID as well as PSC) for every cell you encounter, then upon getting an "unknown" PSC look it up in the stored data. (You would need to filter for neighbors of the serving cell, as the PSC is only a locally unique ID, not a globally unique one).

As an alternative, the PSC of a cell along with the MCC/MNC/LAC/CID tuple of one of its neighbors is also a globally unique ID that you could use. Be aware, however, that each cell would have multiple such identifiers (one for each neighbor).

Pyrogallol answered 3/8, 2014 at 17:33 Comment(0)
B
3

I can get cid and rssi for neighbor cells. So you try this code and it works only on physical material (do not use emulator). here you create your android xml with textview. ;-)

package app.tel;
import java.util.List;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.telephony.NeighboringCellInfo;
import android.telephony.TelephonyManager;
import android.telephony.gsm.GsmCellLocation;
import android.widget.TextView;


public class TelephActivity extends Activity {

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.main);
   TextView textGsmCellLocation = (TextView)findViewById(R.id.gsmcelllocation);
   TextView textMCC = (TextView)findViewById(R.id.mcc);
   TextView textMNC = (TextView)findViewById(R.id.mnc);
   TextView textCID = (TextView)findViewById(R.id.cid);

   //retrieve a reference to an instance of TelephonyManager
   TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
   GsmCellLocation cellLocation = (GsmCellLocation)telephonyManager.getCellLocation();

   String networkOperator = telephonyManager.getNetworkOperator();
   String mcc = networkOperator.substring(0, 3);
   String mnc = networkOperator.substring(3);
   textMCC.setText("mcc: " + mcc);
   textMNC.setText("mnc: " + mnc);

   int cid = cellLocation.getCid();
   //int lac = cellLocation.getLac();
   textGsmCellLocation.setText(cellLocation.toString());
   textCID.setText("gsm cell id: " + String.valueOf(cid));

   TextView Neighboring = (TextView)findViewById(R.id.neighboring);
   List<NeighboringCellInfo> NeighboringList = telephonyManager.getNeighboringCellInfo();

   String stringNeighboring = "Neighboring List- Lac : Cid : RSSI\n";
   for(int i=0; i < NeighboringList.size(); i++){

    String dBm;
    int rssi = NeighboringList.get(i).getRssi();
    if(rssi == NeighboringCellInfo.UNKNOWN_RSSI){
     dBm = "Unknown RSSI";
    }else{
     dBm = String.valueOf(-113 + 2 * rssi) + " dBm";
    }

    stringNeighboring = stringNeighboring
     + String.valueOf(NeighboringList.get(i).getLac()) +" : "
     + String.valueOf(NeighboringList.get(i).getCid()) +" : "
     + String.valueOf(NeighboringList.get(i).getPsc()) +" : "
     + String.valueOf(NeighboringList.get(i).getNetworkType()) +" : "
     + dBm +"\n";
   }

   Neighboring.setText(stringNeighboring);
 }   
 }
Bakerman answered 29/3, 2012 at 15:15 Comment(1)
This does not answer the question. cid and lac are not set in case of an UMTS (HSPA) connection.Archaeology
I
0

Sometimes when more CID's of the same provider share the same tower/site, used to increase capacity and transmitting in the same diriction, have the same PSC. So in those cases you can use PSC to identify the site and beamdirection but not the CID.

Implausible answered 25/8, 2015 at 12:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.