10-06-2016, 09:09 AM
In order for a cellphone to work, it has to be able to connect to a nearby tower, which means that every once in a while it'll send out a message saying "Hello! I'm [cellphone whatever]!" for the nearest tower to pick up. The granularity, the accuracy of the location, will vary, with cities having many towers and lots of very small cells, and the countryside having fewer, larger cells. It can't tell where you are to within a cell with any degree of accuracy.
Still, such location finding is extremely useful if someone rings the emergency services on a mobile and then hangs up before giving a location. They can phone the mobile provider and get them to divulge the location of the cellphone, and send out, for example, an ambulance. Which is handy. Admittedly a bit creepy, but that's sort of the way they have to work.
As with the location data, government services have no direct access to stuff like text messages and call data, having to go through the cellphone provider if they feel they must. They don't hack your phone, so being in airplane mode won't help, they just ask the provider politely. They certainly can't (as far as we know) pluck messages and phone calls out of the air in real time; they're quite well encrypted.
GPS connections, too, can log your location to within a few feet, but only if GPS is turned on in your phone. I'm not sure whether that would be logged somewhere externally, though, or just on the device in question. Certain cloud apps like Google Tracks log locations completely openly (that's the point of the app), but others may not.
GPS logging data has been successfully used in court when a plaintiff insisted he was nowhere near the scene of the crime of which he was accused, and presented such logs from his car GPS as evidence to prove he'd been in another city at the time. It doesn't always have to be creepy and work against you.
I suppose it is possible to upload malware to someone's phone (you'd probably need physical access, I doubt you could do it wirelessly) which would turn on GPS and upload your movements to an external source, but that's pretty much illegal at that point, by all metrics.