O'Reilly logo

Windows® Phone 8 Unleashed by Daniel Vaughan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the Compass Sensor

The compass sensor is a required component of Windows Phone devices. In the first release of the Windows Phone OS (7.0), however, no API was provided for the compass, and some devices lacked the native drivers necessary to use the compass even when running the Windows Phone 7.5 OS (mango). If you are maintaining an app for a premango device, it is therefore important to verify that the compass is supported before attempting to use it. For this, the static Compass.IsSupported property is used, as demonstrated in the CompassViewModel class (see Listing 16.4). The Start method of the CompassViewModel oversees the creation of the Compass instance.

The default value of the compass TimeBetweenUpdates property is 25 milliseconds, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required