It is often useful in a Windows Phone program for the code to know whether or not it is running on a real device. It is actually easy to do this:
- Add Microsoft.Phone to the references to your project if it is not already there.
- Put the following line at the top of your program.
- You can now write code like this:
if (Microsoft.Devices.Environment.DeviceType ==
// we are running on the real phone
You can use DeviceType.Emulator in the test to see if you are running on the emulator.