When creating connections through NFC, how to choose the sending form, Bluetooth or Wi-Fi?

The sending form is chosen automatically by the Proximity API, which has three properties to define which are the valid communication means in the pairing via NFC:

The code excerpt below shows how to set up the PeerFinder to use the infrastructure Wi-Fi instead of Bluetooth:

bool _started = false;

// Method to make listener available for connections started by a Tap

private void SetupNFCListener()

{

if (_started)

{

WriteMessageText("You’re in a connection.\n");

return;

}

if ((Windows.Networking.Proximity.PeerFinder.SupportedDiscoveryTypes &

Windows.Networking.Proximity.PeerDiscoveryTypes.Browse) !=

Windows.Networking.Proximity.PeerDiscoveryTypes.Browse)

{

WriteMessageText("No support for discovering devices via Wi-Fi Direct.\n");

}

Windows.Networking.Proximity.AllowBluetooth = false;

Windows.Networking.Proximity.AllowInfrastructure = true;

Windows.Networking.Proximity.PeerFinder.Start();

_started = true;

}

It’s worth mentioning that, according to experiences performed with the device Windows Phone 8.0, the AllowWifiDirect property doesn’t start a Wi-Fi Direct connection, even if the true value is assigned to it. It’s not yet possible to use this communication channel through Proximity in Lumia devices due to hardware limitation.

Permission configurations in the mobile phone may influence the choice of the communication channel according to testing carried out in devices Windows Phone 8.0. For starting a connection by NFC tap, it’s required that both devices are with Bluetooth activated, or with Wi-Fi enabled.

Last edited Aug 6, 2014 at 10:41 PM by brmontei, version 3