From time to time there is a need to check how our application is being started – in emulator or in real device? To do this we need just to execute the following code:

if (Microsoft.Devices.Environment.DeviceType == DeviceType.Emulator)
  MessageBox.Show("Application has been started in emulator.");

With this knowledge we can change the way of our application’s behaviour on different type of devices. For example if our application is started in emulator we can use different settings for test purposes. Even more we can forbid our application to run on emulator. This feature can be useful also when we would like to show somebody (e.g. testers) that something cannot be tested in emulator, e.g. Bluetooth.