0

When I override the above mentioned function, and log the CellLocation, I receive the following value

[425,56301,-1]

When I roam around a bit, The above value changes to

[425,56302,-1] and [425,56303,-1]

What does these values represent? I think 56301 is CellId. What are other two?

Pankaj Singhal
  • 15,283
  • 9
  • 47
  • 86

1 Answers1

7

Since CellLocation can be either GsmCellLocation or CdmaCellLocation, you have to look at those classes.

In your case, you're using an instance of GsmCellLocation, whose "toString()" is implemented as follows:

@Override
public String toString() {
    return "["+ mLac + "," + mCid + "," + mPsc + "]";
}

we can conclude that:

  • 425 - LAC - Location Area Code - this identifes area of the network where your terminal is currently present. Cellural network consists of cells (ie. one base station handles one cell), and those cells are grouped into location areas. Each area has it's identifier - LAC.
  • 56302 - CID - Cell ID - identifier of a cell which is serving your device.
  • -1 - PSC - primary scrambling code - UMTS only.

About LAC

Location Areas are the logical entity which are defined in cellular networks to decrease the signalling traffic in the network. In short, location area is a group of cells. Each location area is identified by LAC.

When you're moving around, your phone is using different base stations. The phone always knows which base station it can use, because phone is measuring the signal levels pretty often.

On example: if you are in a range of a cell A, and then you move away, and some new cell will have a better range, your phone will notice that immediately. But it should not notify network about that fact, because it will generate enormous volume of signalling data (service cell is being changed pretty often).

On the other hand, what happens when someone is trying to call you? Network has to notify your phone. But it does not know where the phone is. Well, it could send a message to every base station and broadcast it over the radio, but again, this will be a huge amount of signalling traffic. So the network has to know here the phone is.

So, we have a two forces here:

  1. Phone should not notify network every time CID changes (because of huge amount of signalling traffic)
  2. Network should not look for a phone in every cell (again, huge volume of signalling traffic).

Location Areas are a way of finding a good balance here.

  1. Phone will not notify network every time CID changes, only when location area (LAC) changes.
  2. Network will not "page" a phone in every cell in a country, but only in every cell in a given location area.
kamituel
  • 34,606
  • 6
  • 81
  • 98
  • thanx.:). BTW where did you get the code from?? So that I also can look at it when needed. – Pankaj Singhal Jul 31 '13 at 12:23
  • It's in the GsmCellLocation.java in android source code. If you don't want to keep android source locally, you can always find it in various places around the net, like [this one](http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.2.2_r1/android/telephony/gsm/GsmCellLocation.java#GsmCellLocation.toString%28%29). – kamituel Jul 31 '13 at 12:25
  • @kamituel Is any hidden Api available where we can get event CID & LAC changes – Sachin C Dec 28 '16 at 14:56
  • @SachinC - Don't have code at hand at the moment but you should be able to just use public API's to do the job. Just take a look at [TelephonyManager.listen()](https://developer.android.com/reference/android/telephony/TelephonyManager.html). You will pass `PhoneStateListener` instance to it where you need to implement [PhoneStateListener.onCellLocationChanged()](https://developer.android.com/reference/android/telephony/PhoneStateListener.html#onCellLocationChanged(android.telephony.CellLocation)). `CellLocation` instance passed to that cbk will be GSM or CDMA one. For GSM, LAC should be there. – kamituel Dec 28 '16 at 15:13
  • @kamituel i have used it but PhoneStateListener.onCellLocationChanged() called first.it is not working when cell id or pci changed. – Sachin C Dec 28 '16 at 15:39