#UWP – Single source code line to find if our app is on Desktop, #IoT, Mobile, or #XBox

Hello!

Working with Universal Apps is quite grateful. However, before the build 10.0.10240.0, trying to find out the kind of platform that our app was running was a bit complicated.

Today we can solve it with a single line of code, using AnalyticsVersionInfo. In example:

return Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily;


image

It returns us a value of the type:

  • Windows.Desktop
  • Windows.IoT
  • Windows.Mobile
  • Windows.Xbox

And with that we can now continue working. It is most common in this case, is the decision to use a specific API in a platform.

Greetings @ Madrid

-El Bruno

References


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s