如何确定在Windows Phone 8中禁用NFC? [英] How to determine that NFC is disabled in Windows Phone 8?

查看:76
本文介绍了如何确定在Windows Phone 8中禁用NFC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在很多文章中都看到过像这样检查NFC被禁用的方法:

I've seen in many articles a way to check that NFC is disabled like this:

if (ProximityDevice.GetDefault() != null)
   MessageBox.Show("NFC present");
else
   MessageBox.Show("Your phone has no NFC or NFC is disabled");



ProximityDevice.GetDefault() 是
确实返回  null  如果
a手机没有NFC模块。

ProximityDevice.GetDefault() is indeed returning null if a phone has no NFC module.


但是当我在具有NFC模块的手机上查看时,我已在设置中关闭了 ProximityDevice.GetDefault() 返回
a正常的ProximityDevice,如果NFC已启用。

But when I check it on a phone that has NFC module that I've turned off in Settings ProximityDevice.GetDefault() returns a normal ProximityDevice like if NFC is enabled.


有没有办法确定NFC已关闭?

Is there any working way to determine that NFC is turned off?

推荐答案

你好Anatoly,唯一的方法是你做的。见
官方文档(示例部分)

" 您可以创建  ProximityDevice  by
使用 
GetDefault  或  FromId   static
method。
"

"You can create an instance of ProximityDevice by using the GetDefault or FromId static method."

它适用于真实设备。如果你想在模拟器中测试,我建议你
这一个

It works for me in a real device. If you want to test in an emulator I recommend to you this one.

问候。


这篇关于如何确定在Windows Phone 8中禁用NFC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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