In reply to ultrabumbly:
> I wonder how accurate any compass and inertial sensor in the phone might possibly be?
As jkarran points out, the IMU (inertial measurement unit) in smart devices is not good for offset; this drifts in the order of a few seconds or tens of seconds. And when you then do the double integration from acceleration to position, with a drifting offset, you get a hopeless position.
The 3D accelerometer is really intended for changes (playing games by tilting, etc, detecting steps), rather than absolute position. At least, not without some significant and cunning processing to determine and remove the drifting offsets...
The 3D magnetometer and compass in the IMU aren't bad, but obviously susceptible to ferromagnetic disturbances.
A modern, sensitive GNSS receiver will acquire and track signals coming in via the windows in a plane or train, provided you're close enough to give a reasonable view. The obscured sky view means the position fix won't be brilliant (tending to see low elevation satellites), but it will be good enough to show your position on a map of the world...