androidphone-state-listenercellid

Android: PhoneStateListener: onCellLocationChanged


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?


Solution

  • 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:


    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.