tags:

views:

112

answers:

3

I want to obtain the current Local Area Code of the Cell the handset is currently loged in to. How do I get this information?

A: 
TelephonyManager.getNeighboringCellInfo()[n].getLac()
skyman
How do I see which of the cells from the list am I connected to, or does the list only contains the neighbour cells?
Janusz
I think that this is only the list of cells you are connected to.
skyman
You are only connected to one cell at a time, the cells in the list are the cells that you could also be connected to.
Janusz
A: 

To get the current Local Area code you have to get a TelephonyManager

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

then you can get a Gs,CellLocation from the TelephonyManager.

GsmCellLocation location = (((GsmCellLocation)tm.getCellLocation());

the GsmCellLocation has a getLac Method that returns the current LAC.

Janusz
A: 

You can get cell to which you are connected in a following way:

http://developer.android.com/reference/android/telephony/TelephonyManager.html#getCellLocation%28%29

TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE)
CellLocation cl = tm.etCellLocation();
if (cl instanceof GsmCellLocation){
  GsmCellLocation gcl = (GsmCellLocation)cl;
  int lac = gcl.getLac();
}
radek-k