Following several inputs on our mailing-list showing users are having difficulties to use our package with the Nfc Simulator environment, we have prepared a new file to hopefully help those who are simply trying to use NFC on a Android simulator. This new file can be found on the Downloads page.
This new file contains a VirtualBox appliance. You will need to install Oracle VirtualBox software as a prerequisite. It is also recommended that the user has some experience with this software already, before attempting to use the image we provide. Note that we only support the Windows version currently, because the Connection Center software runs on this system only. It is probably possible to use another host OS, but requires some changes in the network environment.
The VirtualBox appliance we provide contains an image of Android (built from Jelly Bean 4.2.2_r1 for this first appliance release) built from the AOSP (“vbox_x86-eng” target) with very few changes besides integration of Open NFC (the changes are listed at the end of this post for reference). It is pre-configured to connect to the Nfc Simulator running on the host system, and should not require any additional change.
Steps to use this appliance:
- Install VirtualBox if you do not have it already
- Install the appliance. A new Virtual Machine is created.
- Download the Open NFC Core or SDK edition corresponding to the Open NFC release of the appliance.
- Start the “Connection Center” software from the Open NFC Core or SDK edition.
- In the “Connection” tab, enable Accept service client connections from other machines and Accept service provider connections from other machines. Restart the Connection Center software in order to enable these changes.
- Start the NFC Simulator software from the Open NFC Core or SDK edition.
- Now, you can start the Virtual Machine. Once boot is complete, you should see activity in the NFC Simulator.
Using adb
It is possible to use “adb” with this Virtual Machine in order to install new applications and/or get android logs, access android shell, etc.
- In the network properties of the Virtual Machine, check/adapt if needed the port mapping setting of the first network connection. By default, host port 5557 is mapped to guest port 5555 (adb port).
- Tell your adb instance on the host to connect to this emulator: adb connect localhost:5557
- Once connected, you can use adb as usual: adb devices, …
Using the system console
It is possible to access the kernel logs and android console on this image. Both consoles are configured to use /dev/ttyS0 (serial port). The first serial port is configured in VirtualBox to redirect to a software pipe \\.\pipe\androidVM (this name can be changed in the Virtual Machine properties if needed). Using for example the PuTTY software, it is possible to connect to this software pipe (simply configure the name \\.\pipe\androidVM for the “Serial line” parameter) and get a working console.
Using Peer-to-peer or Beam
It is perfectly possible to emulate two devices. Follow this procedure in that case:
- Clone your virtual machine to create a second entity
- Edit the name of the serial port software pipe, and the port mapping properties in the network configuration of the new machine to avoid conflict between both machines.
- Start one instance of the Connection Center; one instance of the NFC Simulator, then start your first virtual machine, and finally your second virtual machine. You should see the lights of the second reader light up in the NFC Simulator.
How this virtual machine was built
The primary code was fetched from the AOSP following standard Android procedure. Then we made the following changes:
- Follow Open NFC porting guide to integrate Open NFC. In the configuration of the build, enable the Simulator and disable firmware update and UICC policy by default. Edit the connection_center_access file to use the Simulator by default.
- Rebuilt the kernel (goldfish-2.6.29) with all netfilter options enabled (using external/qemu/distrib/build-kernel.sh –arch=x86).
- Extend the size of the system partition to build with DEX objects.
- Configure the SD Card as emulated card.
- Change the default resolution in the boot command, to emulate a phone screen
- Change the initlogo.rle to use Open NFC logo.
- After initial build, re-compile some grub files with gcc-4.4.3 in order to allow the image to boot (problem with grub source code).

Older posts