Rashmin Javiya
Rashmin Javiya

Reputation: 5222

How to check if the type is device or emulator?

I want to conditionally check device type runtime for windows 10 UWP. there is already a class and enum available for windows phone 8 platform as mentioned below.

Class - Microsoft.Devices.Environment.DeviceType

Enum - Microsoft.Devices.DeviceType

What is equivalent for windows 10 platform?

Upvotes: 0

Views: 235

Answers (1)

Corcus
Corcus

Reputation: 1090

I would suggest this approach. The classes are available for UWP as seen on the documentation

private static EasClientDeviceInformation deviceInfo = new EasClientDeviceInformation();


public static bool IsRunningOnEmulator
{
    get
    {
        return (deviceInfo.SystemProductName == "Virtual");
    }
}

Upvotes: 1

Related Questions