Adding location to a non GPS phone: introducing CellID

In this two part article (see part II here), we will introduce mobile positioning based on CellID, and we will take a look at OpenCellID, the open source database of CellIDs. We will demonstrate how to use OpenCellID through some simple examples. The second part of the article will show how to use OpenCellID with OpenStreetMap and the 8Motion library to create a full interactive mobile mapping experience in JavaME, with each of these examples being less than 100 lines of code.

What is CellID?

We all know that GPS will be deployed in the vast majority of phones in the future. For now though, only a few high-end handsets are GPS enabled. An alternative, which has been available for some time, but which has gained momentum only recently is location based on CellID. So, what is CellID? A CellID is a number which is associated with a specific cell (the radio tower to which your handset is connected). In most cases, this is the closest tower to your location. So by knowing the location of this tower, then you can know approximately where the handset is. This concept is illustrated below. However, a tower can cover a huge area, from a few hundred meters, in high density areas, to several kilometers in lower density areas. This is why location CellID accuracy is lower than GPS accuracy. Nevertheless location via CellID still presents a very useful alternative.

CellID has recently become much more popular, thanks mainly to its seamless integration into GoogleMaps for Mobile.


So this sounds great, let’s just get the device’s CellID, and then we will know its location. So what’s the catch? The issue is that the location of cells is not public information. Operators keep this private, for many reasons including:

  • They don’t want to give tower location information to their competitors
  • They use this as an extra revenue income, as they provide paying services to retrieve cell location

This is the reason we have set up a service called “OpenCellID”. is an open source database of CellIDs, serving two purposes:

  • Anyone can create or use an application to gather information about cell locations, and send this information to the OpenCellID server, thereby improving the coverage
  • The database can be used by any application to retrieve the location of a cell, according to the CellID

How to use OpenCellID

The OpenCellID API is a simple REST API. There are only two relevant calls: measure/add and get/cell.

Measure/add is used to add a measure of cell. This is used by any application that wants to add information to the database. Such applications produce content for the OpenCellID database. To make use of the API, a key is required for communication with The key is used to track application providers, and to ensure that no fake data are inserted into the system.



  • myapikey: Substitute here the key that you received while registering at OpenCellID.
  • mcc: the mobile country code
  • mnc: the mobile network code
  • lat: lattitude
  • lon: longitude
  • cellid: CellID
  • lac: location area code

The URL request above will tell the server that a client found a cell of id 234, for mcc=1, mcc=2 and the lat,lon position of 3.42,3.12. A word of caution: all data should be submitted in decimal, while some handsets (SonyEricsson for instance) provide lac and cellid in hexadecimal, so you will need to convert them before calling the API.

Cell/get is used to get the position associated with a cell. For example:

You need to provide at least mcc, mnc (mobile country code, and mobile network code of the operator), and cellid. Lac (location area code) is an optional parameter, and will help to determine an alternate position if cell is not found. The API will return a simple XML document, like the one below:

This can be interpreted simply as: lat and lon are the coordinates of the cell, based on 38 samples. If needed, you can use the optional parameter fmt to specify an output format e.g.:

will return something like this:


This carries the same information as before, but in a much more compact form (see the API description for a complete description). Others APIs are under development, for instance to retrieve operators from mcc/mnc.

Sample program

So now let’s use OpenCellID to create a small program, written in JavaME, which will just get the CellID from the phone, and obtain the device’s location by making a request to the OpenCellID server and displaying the results.

First, let’s get the CellID:
We use SonyEricsson specific properties. There properties are non standard, and only available on some devices.

Cellid is of course the CellID, mcc is the mobile country code, mnc is the mobile network code and identify the operator and the country (cmcc stands for current mcc). That’s all we need to find our location. Then, verify if these properties are supported:

In this part, we have created the URL to request information on the server, and start the fetch of the information in a separate thread:

If the API call returns something starting with “err”, we are probably in error. Otherwise, we will have our current CellID positioning.

And that’s it done! The complete source code is available to download from

So, what happens if the CellID is not in the database? Then the program will display an error. You can improve the accuracy of OpenCellID by discovering more cells.

The second part of this article, published here, will build on this first part, by creating an interactive program displaying the device location on a map, using the free J2MeMap component.

Exclusive tips, how-tos, news and comment

Receive monthly updates on the world of mobile dev.

Other Products

Try the world’s leading device detection solution at
DeviceAtlas - Try the world’s leading mobile device detection solution

Evaluate your websites’ mobile readiness with
mobiReady - Evaluate your websites’ mobile readiness.

© 2023 DeviceAtlas Limited. All rights reserved.

This is a website of DeviceAtlas Limited, a private company limited by shares, incorporated and registered in the Republic of Ireland with registered number 398040 and registered office at 6th Floor, 2 Grand Canal Square, Dublin 2, Ireland