In regular situations, the location is calculated based on one or several sensors. The data include:
- Cellular networks.
- Surrounding Wi-Fi networks.
- Surrounding bluetooth beacons.
- GPS.
The first 3 methods require radios that can both listen and broadcast radio signals, however the GPS only listens for signals broadcasted by satellites, as it does not broadcasts anything.
When you activate the airplane mode, you are basically telling to the device to stop broadcasting any kind of signal (in order to avoid interferences with the aircraft), however as the GPS chip does not broadcast anything, it can be expected to keep listening for satelite signals and thus, reporting you back the device current location.
You can programatically detect the accuracy of the location object by calling:
location.getAccuracy();
Which is the accuracy of the location in meters.
Edit: Let me add some important points that might be interesting for you:
- GPS first fix is really slow if it does not have assistance from any other radio. It can take minutes until you see the first location.
- GPS needs a clear view of the sky in order to receive signals. So it won't work indoors.
- GPS is one of the more power consuming ways to get location, compared with other techniques.