[UWP]如何检测我的Windows 10应用是否在模拟器或真实移动设备上运行? [英] [UWP] How to detect if my Windows 10 app is running in emulator or real mobile device?

查看:227
本文介绍了[UWP]如何检测我的Windows 10应用是否在模拟器或真实移动设备上运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何知道我的应用目前是否在Windows Phone模拟器或真实设备中运行?

How can I know if my app is currently running in a Windows Phone emulator or real device?

好像http://stackoverflow.com/questions/24811760/determine- if-windows-phone-8-1-app-is-the-the-emulator
不再适用。

注意:

我最初在这里问过:  https://social.msdn.microsoft.com/Forums/en-US/ce27a2be-bc40- 4dbd-a1d9-a7bda3c6497b / uwpat-runtime-how-to-detect-platform-store-or-phone-and-emulator-in-a-windows-10-app?forum = wpdevelop但是因为只有问题的第一部分
得到回答,我创建了一个单独的问题并更改了标题以提高可见度

I originally asked it here: https://social.msdn.microsoft.com/Forums/en-US/ce27a2be-bc40-4dbd-a1d9-a7bda3c6497b/uwpat-runtime-how-to-detect-platform-store-or-phone-and-emulator-in-a-windows-10-app?forum=wpdevelop but since only first part of the question was answered, I created a separate question and changed title for better visibility

推荐答案

你好Virgile,

Hi Virgile,

首先想到的是 #if  DEBUG ,而且模拟器不是模拟器或者,模拟器可以模拟真实设备。

The first thing come to my mind is #if DEBUG, furthermore emulator is not simulator, emulator is the one that can emulate the real device.

Windows 手机模拟器是一个模拟Windows手机设备的桌面应用程序。它提供了一个虚拟化环境,您可以在其中调试和测试Windows 手机应用程序,而无需物理设备。它还为您的应用程序原型提供了隔离的环境

但我想知道你为什么要检测应用程序是否在模拟器或真实设备中运行,如果你能为你的场景解释更多,也许我们可以给你一些建议。

But I would like to know why you want to detect if the app runs in emulator or real device, if you can explain more for your scenario, perhaps we can give you some suggestions.

- 詹姆斯


这篇关于[UWP]如何检测我的Windows 10应用是否在模拟器或真实移动设备上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆