[Go]---How the UWP determines which platform device the current app is running on

Source: Internet
Author: User

In doing WIN10 development, we may often need to get the current program on which platform device to run, for UI and related API calls, then how to know the current app running platform?
Today there are two ways to make a reference for everyone:


Method One: devicefamily
Through Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily, to obtain the current platform equipment, currently only can get two values Windows.mobile or Windows.desktop, respectively, represents the hand Machine and PC (tablet)
(Of course, you may not be windows.watch or windows.television.)
This method is relatively simple, recommended, please note that if you add the Microsoft Mobile Extension SDK for Universal App platform Reference, call some of Mobile's proprietary API, Make sure to make a system decision before calling the API, otherwise you will be on your PC (the lesson of blood)


method Two: Through the Easclientdeviceinformation class
The current system character can be obtained from the following code


String result = Easclientdeviceinformation.operatingsystem;

Turn to Original

[Go]---How the UWP determines which platform device the current app is running on

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.