miguelangelcv
miguelangelcv

Reputation: 127

Check platform on Windows 10 Universal App

How can I check which platform (Windows / Windows Phone) my app is running?

Upvotes: 2

Views: 1709

Answers (2)

James He
James He

Reputation: 397

VersionInfo | versionInfo property should helps to check the platform information.

    var str = Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily;
    if (str == "Windows.Desktop")
    {
      //...
    }
    else if (str == "Windows.Mobile")
    {
      //...
    }

Upvotes: 6

Brakyo
Brakyo

Reputation: 128

Yes, you can use the compiler directives

#if WINDOWS_PHONE 
//some code
#endif

#if WINDOWS 
//some code
#endif

Upvotes: 2

Related Questions