I know what you’re thinking: “You are already sensitive to various orientations, how can you make my Windows Phone application the same?” Lucky you! Microsoft has written a whole API (a kind of radar, if you will) to sense Phone orientation.
Left? Right? Up? Down? Your application determines what is supported. Windows Phone supports multiple sensors providing information about the device’s orientation and location, including Compass, Gyroscope, and Accelerometer.
The Accelerometer tells your application if the user is tilting the phone and how much. Just reference Microsoft.Devices.Sensors and Microsoft.Xna.Framework.
Now, there are these few limitations to remember:
- Not while the screen is locked
- Not by a background agent