Location involves finding out a device’s geographical position, and optionally also its heading and speed.
Several methods are used, depending on local availability and whether you are outdoors or indoors:
- GPS or Global Positioning System consists of a network of geo-stationary satellites that at any given time, and provided line of sight, can position you wherever you are in the world with high precision (a number of meters). Apart from latitude and longitude, you can also get information about altitude, speed and heading, which is quite useful for navigation, mobile surveillance and the like. A major drawback of GPS is that it doesn’t work indoors, as there’s need for line of sight to several satellites simultaneously.
- Cell ID uses the knowledge of where mobile base stations are placed and provides an approximation of the position of the phone that way. Cell ID works as well and exactly the same way outdoors and indoors, as opposed to GPS, but can be very coarse outside cities (100 meters vs kilometers at times).
- Wi-Fi is primarily used for communication of course, but the fact that each Wi-Fi access point has a worldwide unique identifier they can also be used for rough positioning similar to Cell ID, with the addition of rough 3D space. The main disadvantage of Wi-Fi is that it almost only exists indoors for obvious reasons.
- QR Code uses the knowledge of where specific QR Codes have been placed in 3-dimensional space. Precision can be very high as you are most likely very close to a QR Code when reading it, but this also means each and every QR Code and its position need to be registered centrally. Not much used today for location, but rather for identification, temporary URLs for e.g. payment and context-specific information. See more about that on the Barcodes page.
- NFC has characteristics quite similar to QR Code in terms of use, but uses radio instead of vision. Actual use is similar to QR codes.
All smartphones sold today can use all the above methods.
Adding to the possibilities are ways to determine the direction and detail/transient movement of the phone, using primarily the following:
- Measurement of acceleration, via an accelerometer
- Measurement of geographical static heading using a compass
- Measurement of momentary change of direction using a gyroscope
Obvious uses of these features are for games, navigation etc, but also augmented reality applications use them to determine what the phone’s camera is looking at, so information can be overlayed.
The accelerometer is often used for measuring the angle of the phone in e.g. games, as the gravity of Earth (g) is so much larger than the acceleration of the phone itself. As g points straight down (surface-wise), it’s a good reference for the phone’s direction.