13

Is there a method I can call to see if I am currently running in the emulator vs. running on an actual physical phone?

I need to run some code a bit differently when I am in the emulator (I have a mock gps location service).

3 Answers 3

20

You can get this from Microsoft.Devices.Environment.DeviceType

1
  • 6
    if (Microsoft.Devices.Environment.DeviceType == Microsoft.Devices.DeviceType.Emulator) Commented Nov 25, 2010 at 4:40
6
if (System.Environment.DeviceType == DeviceType.Emulator)
{

}

Hope that helps

0
4

For wp 7.5 Mango sdk, it has moved to the namespace Microsoft.Devices

if (Microsoft.Devices.Environment.DeviceType == DeviceType.Emulator)
{
  //Do Stuff
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.