I stumbled across a website that apparently allows users to work out how far the nearest mobile phone masts are. Is there a method of working out this distance hard-coded in android? (Or does anyone have any suggestions of how to complete this?)
-
You will find your answer on this two questions http://stackoverflow.com/questions/5184877/how-to-find-user-location-using-cell-tower-in-android http://stackoverflow.com/questions/6668271/get-cell-tower-locations-android – Robert Estivill Nov 30 '12 at 00:18
-
What is it exactly that you want to know? Do you want to know the phone's location by using cell tower information? Do you want to know the exact location of the cell tower (mast)? Do you want to know the exact distance between the phone and the nearest cell tower (mast)? Please be more specific. – David Wasser Dec 04 '12 at 10:03
-
Not sure how this is ambiguous but I would like to know the exact location of the cell tower and it's distance from the current user's location. (I suppose finding the distance would just require a Location.distanceTo() so the focus could be be on mast/tower location) – Ed Holloway-George Dec 04 '12 at 10:30
4 Answers
One solution could be to disable GPS positionning and enable only cell positionning. I doubt there any triangulation of positionning in that case and the device geo fix will be the one of the closest mast. After that, you use GPS on and get real position and calculate the distance using euler distances.
-
Turn off your wifi radio, too. Then yeah this may work; it's essentially a form of position surveying, albeit a [deliberately] inaccurate one. – Lightness Races in Orbit Feb 07 '13 at 17:33
In GSM the distance from the mobile station to the active cell tower is one of the main parameters of the connection. It is called Timing Advance (TA).
Note, the active mast is usually the nearest, but not always.
The TA value is normally between 0 and 63, with each step representing an advance of one bit period (approximately 3.69 microseconds). With radio waves travelling at about 300,000,000 metres per second (that is 300 metres per microsecond), one TA step then represents a change in round-trip distance (twice the propagation range) of about 1,100 metres. This means that the TA value changes for each 550-metre change in the range between a mobile and the base station.
That is the distance to the current tower is always known to the mobile station to 550 meters accuracy.
This parameter should be easily accessible via standard Android API.

- 315
- 4
- 13
-
"This parameter should be easily accessible via standard Android API.". Please provide a reference – Snicolas Dec 06 '12 at 03:12
-
Wow! I was sure it should be accessible, but looks like it is carefully hidden: http://stackoverflow.com/questions/8111796/get-mobile-cell-tower-timing-advance-on-android-2-3 Here's the issue described officially: https://code.google.com/p/android/issues/detail?id=700 Bummer! – Alexander Shcheblikin Dec 06 '12 at 07:07
-
Anyway, the TA parameter gets set only during a call, so its use would be rather limited, even if it'd be accessible. – Alexander Shcheblikin Dec 07 '12 at 17:34
-
@AlexanderShcheblikin If someone does not make call then TA value will remain same for long time? – Pranit Kothari Aug 07 '13 at 10:42
-
I'd think TA is simply undefined while not in a call, or the mobile station may remember and show the last one seen. Note that GPRS enables terminals also track TA related to GPRS connection which is updated, I think, every time a data packet gets sent or received. – Alexander Shcheblikin Sep 22 '13 at 17:20
-
For **GSM**, TA is not available through any API. For **LTE**, TA is available through `getTimingAdvance ()`, starting from API **17** (AOS 4.2 - Jelly Bean). But you may get TA from OEM_HOOK_RAW...using extraordinary AOS API hacking. – not2qubit Jan 18 '14 at 16:13
After further research I eventually came up with this conclusion:
In the United Kingdom it is now possible to download the dataset provided by Ofcom's Sitefinder Website containing information of over 140,000 mobile masts in the UK that can be manipulated to locate Mobile Phone masts.
This does not answer the question of whether it is possible programmatically in Android but does, at least, provide another feasible option for developers working on similar projects within the UK.

- 5,092
- 2
- 37
- 66