,

Measuring Direction with the Compass

The compass, also known as the magnetometer, is a Windows Phone required sensor that allows your app to determine which direction the phone is pointing—in particular, the offset from magnetic or geographic north.

The compass is useful in applications that use geographic location; for example, you may want to provide a compass arrow as a supplement for a mapping app. The compass also allows you to monitor raw magnetometer readings and to detect changes to magnetic forces around the device.

The sample code for this section creates a page that displays a compass arrow and the various compass readings, and you see how to allow the user to calibrate the compass.

The sample code for this section resides in the /Sensors/Compass/ directory of the WPUnleashed.Examples project in the downloadable sample code.


Note

The compass sensor is rather subject to interference. Bringing the device into close proximity of large metallic objects or other electronic devices, for example, a laptop, throws off the reading.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.210.12