Android 虚拟设备 (AVD) 的 NFC 标签仿真 [英] NFC tag emulation for Android virtual device (AVD)

查看:32
本文介绍了Android 虚拟设备 (AVD) 的 NFC 标签仿真的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在没有支持 NFC 的手机的情况下开发 NFC 标签读/写应用程序?有没有办法创建启用了 NFC 的 AVD?我已经搜索并发现 Open NFC 存在,但我现在找不到太多关于它的信息.它已经过时了吗?有没有其他方法可以实现?

Is there any way to develop NFC tag reading/writing applications without an NFC enabled phone? Is there a way to create an AVD which has NFC enabled? I have searched and found Open NFC exists, but I cannot find much information about it now. Is it already obsolete? Is there any other way to achieve it?

推荐答案

Google 从未在 AVD 中实现对 NFC 的支持.所以安卓设备模拟器中没有官方对NFC的支持.

Google never implemented support for NFC in the AVD. So there is no official support for NFC in the Android device emulator.

早在 Android 上的 NFC 早期,Inside Secure 就开发并发布了 NFC 堆栈Open NFC".尽管有它的名字,Open NFC 并不像它的名字所暗示的那样开放,并且主要针对 Inside 的 NFC 前端范围.该 NFC 堆栈的一个很好的副作用是它的仿真器集成,类似于诺基亚的 NFC 虚拟设备支持其 S40 系列手机的功能.Open NFC 项目的公共文件仍然在 SourceForge 上可用:这里.但是,该项目早已被放弃(可能是由于 向英特尔出售他们的 NFC 技术).

Back in the early days of NFC on Android, Inside Secure developed and published the NFC stack "Open NFC". Despite its name, Open NFC was not as open as its name suggested and was primarily targetting Inside's range of NFC frontends. A nice side-effect of that NFC stack was its emulator integration which resembled the capability of Nokia's NFC virtual device support for their series S40 phones. The public files for the Open NFC project are still available on SourceForge: here. However, the project has long been abandoned (probably due to selling their NFC technology to Intel).

Open NFC 的最新版本针对 Android 4.2.1(与 Android 4.2.2 一起使用),因此如果您可以接受该平台,您可以尝试设置该 AVD 环境.此处提供了分步指南:打开 NFC 模拟器使用(有关缺少的组件,请参见此处:android平台加载open-nfc插件失败).

The last version of Open NFC targets Android 4.2.1 (worked with Android 4.2.2), so if that platform was acceptable to you, you could try to setup that AVD environment. A step-by-step guide is available here: Open NFC Simulator Usage (also see here for missing components: Failed to load open-nfc addon in android platform).

较新 Android 版本上的 NFC 堆栈发生了显着变化(如今,整个 Android NFC 堆栈基于 libnfc-nci,它最初针对 Broadcom 的 NFC 控制器并实施了 NFC 论坛的 NFC 控制器接口规范).因此,Open NFC 的实施不再兼容最新的 Android 版本.

The NFC stack on newer Android versions changed significantly (nowadays, the whole Android NFC stack is based on libnfc-nci which initially targetted Broadcom's NFC controllers and implemented the NFC Forum's NFC Controller Interface specification). As a consequence, the implementation of Open NFC is no longer compatible to more recent Android versions.

请注意,仍然可以通过注入 NFC 意图通过代码进行至少一些有限的测试(例如,对单元测试有用).见

Note that there is still ways to do at least some limited testing through code (e.g. useful for unit tests) by injecting NFC intents. See

但请注意,这些方法依赖于 Android NFC 堆栈的内部结构,您可能需要查看您所针对的任何 Android 版本的代码以模拟正确的信息.

but note that these methods rely on internas of the Android NFC stack and you might need to go through the code for whatever Android version you are targetting to mock the right information.

这篇关于Android 虚拟设备 (AVD) 的 NFC 标签仿真的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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