Directory
Returned directory
1. Configuration
Implement analog NFC transmission in two WP8 simulators, such:
As we all know, the WP8 simulator does not support analog NFC, Bluetooth and WiFi direct transmission (WP8 system does not support WiFi direct at all ). The msdn document mentions a small tool that can simulate NFC transmission: proximity tapper.
To use this tool, you must first run multiple simulators in Visual Studio. Visual Studio does not support multiple instances of the same simulator, therefore, you need to deploy the program and run it in a simulator with different names:
Run proximity tapper. Note that the firewall cannot block proximity tapper. If there is no problem, the running simulator instance will appear in the device list in proximity tapper, and the background color is green:
Then, select the two simulator instances to be connected by NFC and click "tap selected devices and remain connected". Then, the two simulator instances are connected successfully, and the new connection is displayed on the lower side, you can also use proximity tapper to disconnect or manually send data. The right side is the data transmission status in the connection, such:
After both simulators run the current program, after the connection is established, both programs will prompt "connection successful", and then NFC transmission can be performed. Of course, the program is just an example, it transmits simple text.
Returned directory
2. Code
Windows 8 and Windows Phone 8 use the same winrt API for device proximity sensing transmission. All types are stored in the windows. Networking. Proximity namespace. There are two methods for NFC transmission.
One is through the peerfinder type, and the other is through the proximitydevice type:
Proximitydevice is easier to implement, while peerfinder is similar to socket.
In this example, proximitydevice is used for implementation. For the peerfinder NFC communication implementation, refer to Nokia's official NFC chat project. (Of course, compared with Nokia's NFC chat, the sample program in this article is simply weak .)
Source code download
Download Page
Note: the link is the Microsoft SkyDrive page. When downloading, use a browser to download it directly. Some download tools may not be available for downloading.
Source code environment: Microsoft Visual Studio express 2012 for Windows Phone