Calibrating the Compass

Over time, the compass sensor can become inaccurate, and this is exacerbated if it is exposed to magnetic fields. Calibration of the device is performed by the user, by moving the phone repeatedly in a figure-eight pattern (see Figure 16.6). The Compass.Calibrate event is raised whenever the OS detects that the heading accuracy is worse than 20 degrees, at which point it is your app’s responsibility to display a dialog to the user with instructions on how to perform the calibration motion.

Image

FIGURE 16.6 CompassView page showing calibration instructions.

The CompassView page includes a StackPanel with the calibration UI, ...

Get Windows® Phone 8 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.