Default Compass in G1.

Hey,
For an application I am writing, I need to know the exact orientation of the phone in a specified point of time. Such data can be extracted from a Gyroscope sensor - but as far as I understood, there is no gyroscope in G1.
Nevertheless, I do know that it has a gravity sensor, and I downloaded an application which works as a compass - I believe the combination of gravity information and compass should be enough for me to tell the exact 3D orientation of the phone.
My question is, how did that application get the data for the orientation of the phone, in order to display the direction of north? I couldn't find a working sensor for G1 which gives that data.

Thank you very much in advance and have a nice day,
Ron.