Testing your app all together
So far, we have set up and configured several parts of the puzzle—from Open NFC Android Edition to the Simulator, passing through the AVD and the Connection Center tool.
While these puzzle pieces are very important, we can't do much with the individual pieces. So, it's time to bring them all together.
Getting ready
The following are the settings required for this recipe:
- Make sure you have downloaded Open NFC SDK Edition—refer to the Downloading Open NFC SDK Edition recipe
- Make sure you have properly configured the Connection Center tool—refer to the Configuring the Connection Center tool recipe
- Make sure you have properly configured an AVD—refer to the Configuring an NFC-enabled testing AVD recipe
- It's assumed that the Open NFC SDK Edition Core is located at the
NFCBook
folder in your home directory and that the Android SDK location is known
How to do it…
We'll run everything and perform a simple test to make sure everything works properly before we start our first application:
- Start the Connection Center tool located in the Open NFC SDK Edition folder. You will receive a Waiting for a connection… message.
- Start the NFC Simulator tool located in the Open NFC SDK Edition folder. In the previously started Connection Center tool, we should see a Connected! message as shown in the following screenshot:
The Trace Server should be automatically started as well. We should now have the Connection Center tool, the NFC Controller Simulator, and the Trace Server running.
- Start the previously configured AVD by clicking on Start in the Android Virtual Device Manager located in the Android SDK folder.
- Once the AVD has started, we should see the following (or similar) information in the previously started tools:
- In the Connection Center tool, we should start seeing the following NFC Controller-connected messages:
- In the Trace Server, we should start seeing a tree that shows the devices connected (on the left) and any activity in the log list, as shown in the following screenshot:
- In the NFC Controller Simulator, several orange lights should appear that indicate what communication standards the device supports, as shown in the following screenshot:
- Now, we are going to do the final test. In the NFC Controller Simulator, double-click on [MIREFIRE_UL_TAG2_LOCKED] in the Object List panel.
In the NFC Device #1 Antenna panel, a green light should appear, which means the tag was successfully dispatched to the simulator. In the simulator, the browser should be started. Now navigate to http://www.google.com/indexToFillSomeC, as shown in the following screenshot:
How it works…
The Connection Center tool is the first to be started. It listens for connection requests; so, when the Simulator and the AVD start, they will try to connect to a listening server. If no listener is running, nothing happens.
In the Trace Server, we can see what's happening in the communication between the devices. The sent and received messages and communications errors can be found here.
In the Simulator, we can easily see when a device is connected by looking at the top-right box. Here, we find a lot of information such as the communication standard supported by the device, represented by the orange circles, and the standard used in the last communication, represented by the green circles. The Simulator tool provides many other features such as creating custom tags. There is a detailed manual on this in the Open NFC SDK Edition Core folder.