How does an android compass application work? I recently installed a Compass app on my phone (it's a HTC Wildfire S if it matters) and I'm curious as how it works.

Found some answers online that the phone's hardware has a digital compass in it, is that it? or is it just a smart use of other sensors?
Yes, it has a magnetic sensor / digital compass.