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. Owen Griffin says:

    Just a note of caution, your Cell ID might not be a very reliable source of information. They are subject to change, and, as far as I know of, there are no public databases matching Cell ID to location.

    It should be reliable enough however to give you a general Home, Work or Pub location. Unless you are lucky enough to live very close your local. 🙂

  2. dale says:

    Interesting to hear that network operators sometimes change cell IDs – I didn’t know that.

    As you say, a week or so playing with FindMe has seemed to suggest that CellID is accurate enough to tell the difference between ‘home’, ‘shops’, ‘work’, etc.

    Even with it’s limitations, I do like how much quicker it is than waiting for a GPS fix, and how it can work indoors.

    I wonder how the Windows Mobile Google Maps app does it’s GSM cell id ‘My Location’ stuff… have they built up their own database of Cell ID to Location?

  3. dale says:

    From a post to the Fire Eagle Yahoo group, it looks like the guys at Electic Pocket behind FindMe had a similar idea and are trying to write a CellID FireEagle app of their own.

  4. hi, I am working on something similiar. but I have a question, if you can obtain all the cells (normally around 6 or 7) info using RIL?

  5. dale says:

    Hi Peng

    Sorry – I don’t know. I got the info to write my code from MSDN – all I can suggest is that you might wanna have a look there to see if there is an API call to get what you need.

    Good luck!

  6. Hank Lynch says:

    Hey there,
    Found your post after reading

    Thought it might help with the Google Maps stuff, although it +does+ go against their user license to do so.

    Thanks for the code!!

  7. dale says:

    @Hank – thanks for the link – is cool to see an approach to geocoding from a cellid. I’ve not tried that before

  8. bedouser says:

    check this site,, it provides free cell-ID lcoation SNS in China, claim to support top 20 cities in China.

  9. Tomsoft says:

    Interesting. I’ve just launched which should provide an open source database for cell id.
    I would be very interested if your application connect/gather the database…

  10. dale says:


    I was toying with the idea of hacking together something like this for my personal use: something that gets my GPS coordinates and stores it with the GSM Cell ID, repeating this periodically.

    I’m curious about the distribution of GSM cells in my area, and thought it might be interesting to see what data this would collect if I left it running for a few weeks.

    Owen’s comment above – that cell ids are not necessarily fixed – gives me pause about wider use of this.

    I like the idea of an open cellid database, but the scale of the task to collect this information seems somewhat daunting. The number of people who might be willing to run such an app to collect this data with no immediate benefit (in fact, actually at some cost considering the battery life implications) seems to be somewhat limited. I wonder whether it will be possible to collect cell locations fast enough to maintain up-to-date relevant data?

    I’m not sure…

    That said, if I do write something that could collect this sort of stuff, I’d be happy to share it with you. And I’ll be watching with interest to see how your project develops – good luck!

  11. Tomsoft says:


    – About the cell that could potentially move: This is in theory possible, but this does not happens too much practically. Once an operator got a location for a base station, he usually try to keep it. So I don’t think it’s a big issue.

    – Now, the idea about collecting cell id is to do it in a transparent way for end user. Typically, some GPS handsets (typically latest SE) will allows both an access to the GPS and the cell ID at the same time. So collecting ids will be done in a transparent way for end user, if the use an application like mine (

    Unfortunatly, there is no handset YET on the market with both access to CellId and GPS on JavaME. Nokia N95 for instance, does not provides access to CellID but access to GPS. SE provides access to cell id, but does not have yet embeeded GPS (but this will change in the near future).
    But if you use 8Motions with an external bluetooth receiver on SE, the data will be collected automatically.
    So I excpet to have a big boost on the database when first SE with embeeded GPS will appears.
    But in the meantime, any efforts to try to build the database will be helpfull!

  12. […] things mobile, father of small girls, IBM code monkey, youth charity trustee… « Programmatically getting the CellID from your Windows Mobile phone Twitter for Windows Mobile […]

  13. Marcel says:

    We at have a free J2me application which uses
    GPS (bluetooth, internal GPS or cable GPS) and gathers the CellId for
    modern Sony Ericsson phones (like k550i) and feed the
    information to

    In case Watchee has no GPS it uses the Cellid to lookup the lat/lon
    from to be tracked in real time over the web.
    If you take photos or send xSMS messages those are tagged with above
    location informations.

    Works like a charme.
    Thanks to Tomsoft for the opencellid DB!

  14. prasanjeet says:

    is there any way to get your own number programmatically if not stored either in your device or SIM.

  15. […] before based around knowing when you are at a known fixed location – e.g. using GPS or the phone’s GSM Cell Id – but I’ve not seen it done for mobile locations using Bluetooth. So I think it could be […]

  16. Hammer says:

    Is there other ways to get LAC and CellID? I think some smartphones don’t support RIL_GetCellTowerInfo. Your code greatly works on HTC Touch, but doesn’t work on Samsung i600.

  17. dale says:

    Depends what you mean by “don?t support RIL_GetCellTowerInfo”.

    If you mean “handsets which don’t ship with RIL.dll” (of which there are apparently several), then have you tried obtaining a suitable copy of RIL.dll that you could install with your app?

  18. Neil.Youn says:

    For Symbian OS there is currently not ANY ONE commonly usable interface to get MCC/MNC/CID/LAC from the “RIL” there. Nokia and friends do keep their secrets until they die. Especially friends of J2ME are out, C++ and Python hackers do have their small chance on S40, S60 2nd and S60 3rd FP1.

    The first really usable J2ME interface for CID comes with S60 3rd FP2, but this would force you to bye a N96 🙂


  19. Neil.Young says:

    Hmm. I was too stupid to write my name 🙂 Neil.Young of course 🙂 Forever.

  20. Hammer says:

    I can see ril.dll in the samsung’s windows folder. When I tried to run your code, I got HRESULT as E_NOTIMPL return from the RIL_GetCellTowerInfo method. I’ve tried with my own native version to get LAC and CellID, but i got the same error on samsung one.

    Thanks for your reply.

  21. Ronny Gydar says:

    We have some issue, we get cellTowerInfo to work fine on TytnII’s, TouchDuals and an Eten 800 we have here…but many of my collegues have Samsung i600, and they do not work.

    Is there any patch/upgrade to the Samsung one can do? Or some other way to get the CellInfo on these phones?

  22. Ronny Gydar says:

    Meant to say we got “sAme” issue not “sOme” issue! :-O

  23. saulius says:

    hi there…
    i’m currently trying to do cell_id monitoring on n80…
    what i manage to do is get current cell id we are connected. what about others? is there a way to get a list of them

    If you have any ideas let me know.
    saulius at

  24. renato says:


    I tested it on a TYTN II and it is working fine. But when i try to run it periodically, and the cell phone is in low power mode (and not charging), cell id returns alway the same, even if i’m driving around the city. Do you know how to wake up the RIL before getting the cell id and how to put it to sleep again just after?

    Thank you for any help and also for this great article! 😉

  25. sang says:

    Symbian can get cellid and other information na..

  26. Tili says:


    As far as I have read and understood, RIL is all nice to get CellID but when it comes to selling or distributing the application, you need Privileged Certification. Moreover, the API is only documented in Windows Embedded CE (OEM) but not really part of WM 6 SDK and Documentation.

    This means we can’t just use RIL in commercial apps as Microsoft won’t allow it unless we get approval of mobile operators also.

  27. guest says:

    check this service in China, Using GPS or cell ID to do location based stuff, support all Symbian S60 phones, very cool~

  28. Tim says:

    I just installed an cell ID app on my WM Blackjack 2 that is free from and it works fine.. It updates my location whenever I change cell towers and it updates my Facebook and Twitter accounts also.

  29. davestar says:

    Is there a way to get cell id on web mobile browser?

  30. @davestar – BlackBerry’s support this, i looked around, but WM doesn’t do it (yet).

  31. aniket says:

    i am working on project of vehicle tracking system .
    the vehicle will have gsm module and microcontroller
    and it will send the location on the desired cellphone.
    anyone knowing more please send details

  32. Ben Druitt says:

    It seems to me that the most important feature for GSM triangulation is missing…ie the ability to see the cell IDs of MULTIPLE towers in your immediate area so that triangulation can actually be performed. Anyone know anything about that? Currently I am only aware of function calls which list the cellID of the tower you’re currently connected to. Does Navizon or Google Maps manage this? If so, there must be a publicly available function to achieve the same thing.

    Ben Druitt.

  33. […] Getting the CellID is a little tricky. There is some discussion on this from when I first came across it which goes into more detail, but in short, your phone might not […]

  34. Clever_Mind says:

    well, when i use your code, it crashes at RIL_Initialize and throw argumentnotsupported exception. one more thing that i am developing this application for windows mobile .net 1.0.

  35. Salva guillaume says:


    i find an error in your Cell ID.
    rilCellTowerInfo.dwCellID => is the number of the Cell ID, it’s ok, but when a use your code, this Cell ID is not upper to 65 535… like this Cell ID is “coded” on 2 bytes… but in a reality, Cell ID is on 4 bytes… i find a error in your code, but i don’t look !
    If you look something…

    Thanks !


  36. dale says:

    @Salva – Thanks for your message. You might be right – I’ve not looked into it in detail.

    I got the structure from MSDN here: which says that the cell id is a DWORD. So I represented it as a uint, as recommended in MSDN here:

    So there wasn’t a lot of thought that went into it. Do you think a different data type would have been more appropriate?

  37. Salva guillaume says:

    thanks Dale,

    I’m okay with you on the format which you use, but the problem is here !
    I tried with an Uint32 with no sucess….

    Nobody find a same problem ?

    It’s strange…

  38. yuchin says:

    Hi dale,

    Thanks for your sharing about RIL code. I can run it on my windows mobile 6 phone, HTC diamond. I have a question that is it possible to get all cell Id around your phone? I’ve read all the radio interface layer library but it seems that no function support it. I want to get all possible cell Ids because if next time when I go to the same location, it should be possible that different tower will provide service for my phone. Or is it wrong for my worry?

  39. dale says:

    @yuchin – I don’t know how to get neighbouring cell info, sorry. I agree it could be useful data, but I’ve never seen a way to get it.

  40. tom says:

    Hi dale, re the cell id’s, if you are able to use phone a a modem you can use the following at commands at+cops=? to list the networks then register on each network at+cops=1,2,234xx where xx is the network id then at^smonc this will give you the cell details of the active cell and information of other cells the modem can see.

  41. Wei-Meng Lee says:

    Hi Dale:
    Interesting and useful wrapper for the RIL class. Do you mind if I mention it in one of my upcoming articles and training courses? I will attribute it to your site. 😉

    Wei-Meng Lee

  42. dale says:

    @Wei-Meng Lee – sure, sounds good

  43. droll says:

    I’ve been working on cell-id related stuff on Symbian for a number of years but switched to the WM platform.

    here are a few ideas that i implemented before on Symbian. should be easy to replicate on Windows:
    1. recording function – record cellids in a db as you move along and later go back and review it to assign approximate locations
    2. sms query function – your wife can sms your phone and it’ll tell her where you are via sms 😉
    3. reminders by location – yup, as you mentioned. as you know, reminders by time (the traditional ones) aren’t always the right way to structure reminders. you can also combine reminders with time and location e.g. – “Why are you not at home by 5.30pm????!!!” 🙂
    4. setting profiles by location – silent profile in the office, super loud profile elsewhere, etc.
    5. switching on wifi to autosynch using activesync when you’re in the office.

    have fun 🙂

  44. nitrane says:

    Hi Dale,

    I found your page when I was searching for some examples regarding CellID on Windows Mobile Phones. Apparently it seems to work on my HTC P3300. But I do not get any MCC and MNC information. They are both 0 in my application.

    Is it because of the device not supporting this functionality ? Does anyone get the MCC and MNC information correctly?

    Best Regards,

  45. dale says:

    @nitrane – I seem to get the MCC and MNC values okay. Don’t know why it might not work on other devices though – sorry.

  46. […] a Windows mobile client to fill OpenCellID database. All the informations are available on his blog: Programmatically getting the CellID from your Windows Mobile phone. The post contains also some great informations related to CellID for Windows Mobile, […]

  47. Manvendra says:

    this code is not working for HTC s710 i am not able to get MCC and MNC values ,right now i am getting 0 for these values.plz help me. and reply me on my gmail account.

  48. Joubert says:

    I have the same problem as Mavendra. Someone has the answer?

  49. Michael says:

    Hi Dale,

    I am trying to retrieve some additional details from the CellTowerInfo structure and have no success.
    The details that you are talking about are working fine…
    The additional parameters that I need are:
    – dwBroadcastControlChannel
    – dwRxLevel (should be retrieved only during a call)
    – dwRxQuality (should be retrieved only during a call)

    I am not able to retrieve these 3…

    Do you have any idea?

    By the way, I use HTC TyTN II…


  50. Michael says:

    BTW, I am able to retrieve MCC and MNC on HTC TyTN II…