After some searching on Google, I ask myself:
Is it possible to build a compass (simple showing the heading/direction) with the iPhone 3G's GPS sensor?
I have the suspicion, that this is only possible, if the device is moving.
Any ideas are appreciated.
The Compass app shows you the direction iPhone is pointing, your current location, and elevation. Note: Your coordinates and elevation may not be available in certain countries or regions.
Once the compass has been calibrated, the compass at 0 degrees will point to magnetic north — this differs from True North. If you want your iPhone's compass to always point to True North, you can change it by going to Settings > Compass > "Use True North."
Compass gives accurate readings of both true north and magnetic north, and both are valid indications. True north, which is a GPS bearing linked to the geographical location of the North Pole, works when Location Services is turned on.
With the original iPhone and iPhone 3G, no.
With the iPhone 3GS available June 2009, yes. It includes a magnetometer which would allow for a compass application.
The Core Location Framework provides this information in the CLHeading class. You can check if the device supports this function with the magnetometer
key.
As others have said, with the iPhone 3G you would be able to tell the direction of movement when the phone is moving, but you would not be able to tell the orientation of the phone to indicate direction to the user. Certainly the user can be instructed to orient the phone in a certain manner which combined with the movement could indicate direction accurately.
Yes, you are right, that's the only way. Although I think once you know the direction, you could track small movements of the phone from acceleration sensors and draw the direction accurately even if the original movement stops.
Note: This is outdated info, it was correct up until 3Gs came out. Unfortunately I can't delete accepted answer so just look below.
As an update to this, the iPhone 3GS does include an actual, working digital compass that is available to apps. It makes writing such an app trivial.
See the CLHeading
class and the magneticHeading
property.
http://developer.apple.com/iphone/library/documentation/CoreLocation/Reference/CLHeading_Class/Reference/Reference.html
You can also get a true north heading, assuming that the phone has had time to locate itself geographically.
By scanning the available applications I've come to the conclusion that there are two ways to make a compass for the current iPhone 3G.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With