Android的:如何改变NFC协议的优先级? [英] Android : How to change NFC protocol priority?

查看:1480
本文介绍了Android的:如何改变NFC协议的优先级?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我自己的Andr​​oid应用程序(App A),它的读取和写入NFC标签和ISO-14443 A类标签。它运作良好,在许多Android设备。

I have my own Android app (App A) which reads and writes NFC tags and ISO-14443 Type A tags. It works well on many Android devices.

我想给ISO-14443标签的作用,我Nexus5,所以我实现了我自己的HCE(主机卡仿真)的应用程序(App B)我Nexus5。当我触摸Nexus5上的外部NFC阅读器(使用ISO 14443),它完美的作品。

I want to give the role of ISO-14443 tag to my Nexus5, so I implemented my own HCE (Host Card Emulation) application (App B) on my Nexus5. When I touch the Nexus5 on an external NFC reader (which uses ISO 14443), it works perfectly.

然而,当我触碰Nexus5(附录B)上Nexus7(运行应用程序A),P2P(Android的光束)的数据交换序列的开始。

However, when I touch the Nexus5 (App B) on a Nexus7 (running App A), p2p (Android beam) data exchanging sequences start.

我关掉Android Beam的功能在两台设备上即使经过,没有什么变化。该Nexus7不显示'感动梁的屏幕,但是P2P检测播放声音。

Even after I turn off Android beam functions on both devices, nothing changes. The Nexus7 doesn't display the 'Touched to Beam' screen, but the p2p detect sound plays.

LogCat中显示,Nexus7尝试建立一个LLCP连接。

LogCat shows that Nexus7 tries to establish an LLCP connection.

我要那Nexus7重点检测了ISO-14443 Nexus5行政总监,而不是Android的光束。

I want that Nexus7 to focus on detecting the ISO-14443 HCE of Nexus5, not Android beam.

我要如何改变NFC检测优先级,以preference到ISO-14443在Android的梁木呢?

How do I change the NFC detection priority to give preference to ISO-14443 over Android beam?

推荐答案

解决方案是仅适用于Android 4.4奇巧(它可为Nexus 7)可用。您需要启用所谓的读取模式,这是专门用来处理这种特殊情况下,使用<一个href=\"https://developer.android.com/reference/android/nfc/NfcAdapter.html#enableReaderMode%28android.app.Activity,%20android.nfc.NfcAdapter.ReaderCallback,%20int,%20android.os.Bundle%29\"相对=nofollow> enableReaderMode()

The solution is only available on Android 4.4 Kitkat (which is available for the Nexus 7). You need to enable so-called "reader mode", which is designed to handle this particular situation, using enableReaderMode().

在这种模式下,NFC控制器将仅作为一个NFC标签读/写器,从而禁用任何对等网络(Android的梁)和此设备上的NFC适配器卡仿真模式。 [...]对于使用Android的基于主机的卡仿真与那些其他Android设备上模拟标签交互,推荐标志 FLAG_READER_NFC_A FLAG_READER_SKIP_NDEF_CHECK

In this mode the NFC controller will only act as an NFC tag reader/writer, thus disabling any peer-to-peer (Android Beam) and card-emulation modes of the NFC adapter on this device. [...] For interacting with tags that are emulated on another Android device using Android's host-based card-emulation, the recommended flags are FLAG_READER_NFC_A and FLAG_READER_SKIP_NDEF_CHECK.

这篇关于Android的:如何改变NFC协议的优先级?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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