Programmatically getting the CellID from your Windows Mobile phone

I’m still on paternity leave at the moment, so time near a computer is limited to 20 or 30 minute periods in the rare occasions while Faith is asleep!

But in the last few days, I’ve still been playing with a few new geeky things. One of these is FindMe – a Windows Mobile application from Electric Pocket.

screenshot of FindMeThe basic idea is:

  • it gets the CellID of the GSM transmitter that your mobile phone is currently talking to
  • if it hasn’t seen this CellID before, it displays “You are in a new place” and prompts you to type in a name for where you are
  • if it has seen this CellID before, it uses the name you last entered for it

Then it uploads your name for the CellID (your description for where you are) to your Facebook profile.

Hey presto – location tracking without the need for GPS.

It works quite well.

I’ve played with location based stuff on my phone before but never tried to use GSM cell id before. I did consider it, but after failing to find a free database that could transform the cell id string into a location I could plot on a map, I didn’t really pursue it any further.

Playing with FindMe encouraged me to give it a try.

I don’t know how the FindMe app is implemented, but after a little bit of playing tonight, it seems fairly easy to grab something similar to the “Cell” string they are using from the RIL_GetCellTowerInfo function in the Radio Interface Layer (RIL) API.

  1. Call RIL_Initialize to get a RIL handle
  2. Call RIL_GetCellTowerInfo to get the information about the cell tower the phone is connected to

    The “Cell” string that FindMe displays seems to be a combination of the dwCellID, dwLocationAreaCode and dwMobileCountryCode fields

  3. Call RIL_Deinitialize to release the RIL handle

It seems to work okay.

Well… 150 or so lines of C# hacked together while Faith naps, generates the same strings that FindMe displays for the two cells my phone can bounce between in my house. Not exactly conclusive testing :-)

I’ve put my code here in case it is useful to anyone. Usual disclaimers and provisos apply (i.e. it may be gibberish).

I’m not sure what I’m going to do with it. The biggest problem is still the lack of a database to be able to translate the cell tower info you get into an actual geographical location. But if – as with FindMe – you’re willing to invest the time to “train” an app and build up your own cell id database of locations, then there is some potential for interesting apps.

I might try writing a location based reminder app – could be interesting to extend the Outlook Tasks db to have something that reminds you of a task when you’re in a specific location. For example, it’d be good if your phone prompted you with things you want to remember to buy when you’re at the shops. The Tesco garage on my drive home from work is far enough away from anything else I go to that it’d probably have a cell ID that I wouldn’t otherwise be in. Likewise, once I work out the cell ids for Hursley, I could have something that can remind me of something when I get to work.

Or, I could use this as an excuse to play with Fire Eagle. I’ve had the invite for that for a while and still haven’t got around to giving it a try. It could be cool to write something that lets you update your Fire Eagle location using Cell ID info.

Tags: , , , , , , , , , , , , , , ,

115 Responses to “Programmatically getting the CellID from your Windows Mobile phone”

  1. Panayotis says:

    For a free cell-ID database you can also check

    Not as detailed as the Ericsson site, but good for most European countries.

  2. Sushil says:

    awesome.. very simple n neat….. but i tested on multiple mobile.. it works on some mobile smoothly.. in some mobile it gives mnc mcc zero.. i guess that wil mobiles security problem.. there is another solution for that used RIL_GetCurrentOperator…if that also not working used the imzi number of mobile which gives mcc n mnc number… for more information used the wikipedia link…or google by imzi…
    anyways thnks for the code…

  3. Ales Rosina says:

    Hello! Thanks for this app, I used it in one of my apps.

    I have also wrote blog post about that, so you can check it – it’s about connecting cellid with GPS coordinates and drawing that on a map.

  4. Markus Korbel says:

    Just in case somebody else stumbles into this problem (which nearly drove me crazy trying to solve it): David Zhang has posted a really important fix for the RIL wrapper class that prevents the garbage collector of C# from collecting the callback method. That caused a WinCE501bException in my application which can not be handled by .NET!!! So it was always crashing back to Windows displaying the “Send/Don’t send error report” dialog.

  5. Kamaloo says:

    I have some problem: RIL.GetCellTowerInfo(); always returns 0-0-260. Can someone help me?

  6. Kinjan says:

    do you have this CellID code converted in VB.NET? it will be of great help to me

  7. dale says:

    Hi Kinjan – No, I don’t, but it should be a reasonably straight-forward one-to-one mapping with the C# .NET code. Kind regards, D

  8. yudha says:

    I want to ask you about Cell ID,
    – Can I convert Cell Id to coordinate latitude and longitude without API from google?
    Because If I got coordinate latitude and longitude from googlemaps API I must connected to internet..

    Thx sir

  9. dale says:

    yudha – You’d have to find a database of cell locations that can be downloaded. I’ve not seen anyone prepare such a database for offline use, although there are a couple of databases around (e.g.

  10. Kinjan says:

    Hi Dale,

    I tried this but not working. VB.NET is not allowing getting correct Cell ID.
    please help


  11. dale says:

    Sorry – I’m not able to support this code. It’s been a couple of years since I was playing with this stuff, so you might have more luck with someone with more current knowledge.

  12. [...] gets the CellID of the GSM transmitter that your mobile phone is currently talking to Programmatically getting the CellID from your Windows Mobile phone dale lane Waar dat ding staat is dan weer te bepalen met googlemaps aan de hand van de coordinaten. Do GPS [...]

  13. domingo colman says:

    Great work Dale

    I have only a curiosity. The RIL can capture and identify the Cell_Id of an operator that is different from that which corresponds to the phone’s SIM card?

    Thanks, Greetings


  14. dale says:

    domingo – Sorry, I’ve not used RIL for nearly three years now – to be honest, I can’t remember if that’s do-able. I doubt it, though.

  15. [...] Programmatically getting the CellID from your Windows Mobile phone on [...]