Over a million developers have joined DZone.

Getting Your App's "Close", Using Windows 8.1/WinRT and Wifi-Direct and Proximity API's

· Mobile Zone

Stéphanie Hertrich - WinRT : Transferring a file between 2 peers using Wifi-Direct and Proximity API

On Windows 8.1 and WinRT, Wifi-direct enables wireless direct communication scenarios between devices executing the same application. That means you can exchange data between peers in areas without any internet network connectivity. All you need is a device that supports Wifi-Direct technology (Surface RT does, as well as most Windows 8 devices). This is complementary to the Share charm functionality which helps sharing data between 2 apps on the same machine. Here you will share stuff on different machines that are executing the same app.

Wifi-direct can be a good alternative to NFC for some scenarios : you don’t need any NFC hardware but still can communicate between several close peers without network connectivity. If ever you want to test NFC but you don’t have the appropriate hardware, I wrote an article explaining how to install an NFC simulator driver on Windows 8.1 : Windows 8.1 : How to use Near-Field Proximity API without NFC hardware.

Wifi-direct communication is made possible thanks to the Proximity API (just like NFC does, but with different scenarios).

Here is a small lib providing the Wifi-direct file transfer functionality and its sample demo application so that you can test it.

Please be aware that this was not tested for production : if you use it as is, it is at your own risks.

In this article, you will find:

  • how to use the lib and the sample app
  • behind the scene : how the Proximity API handles Wifi-direct
  • more possibilities for Wifi-direct scenarios

How does the lib work ?

The WifiDirectTransfer library is based on the Proximity API. It is VERY easy to use : you just need 3 lines of code.

The lib contains a WifiDirectFileTransfer class.



While I'm very likely going to highlight this in a future Coding4Fun Blog post, I wanted to call it out here as this post really looks like it makes Wifi-Direct enabling your applications easy. So now you can build your next awesome app and while in the car, plane, train this holiday you can share your data, no net required! Imaging building your kids a card game where they can share or trade cards. No wait! A license plate game where they are take pictures of plates and then trade them... hum... Thinking about that, a recent post I did on the C4F blog might come in handy too, Windows 8.1, Windows Phone, NFC, Bluetooth and help in building connected app's.

dotnet,microsoft,tools,api,visual studio,data access,.net & windows,c-sharp,nfc,proximity

Published at DZone with permission of Greg Duncan , DZone MVB .

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}