I am trying to connect two windows phone 8.1 devices via Bluetooth. I have two buttons, one to discover peers, and the second one to connect.
I am sure I enabled the internet (client & server) and proximity capabilities. here is the code: (the first button works fine)
private async void Button_Click(object sender, RoutedEventArgs e)
{
PeerFinder.AlternateIdentities["Bluetooth:Paired"] = "";
var peerList = await PeerFinder.FindAllPeersAsync();
if (peerList.Count > 0)
{
t1.Text = peerList[0].DisplayName + "\n";
}
else t1.Text= "No active Peers";
}
private async void Button_Click_1(object sender, RoutedEventArgs e)
{
PeerFinder.AlternateIdentities["Bluetooth:Paired"] = "";
var peerList = await PeerFinder.FindAllPeersAsync();
if (peerList.Count > 0)
t1.Text = peerList[0].DisplayName;
try
{
PeerFinder.Stop();
StreamSocket socket = new StreamSocket();
await socket.ConnectAsync(peerList[0].HostName, "1");
...
User contributions licensed under CC BY-SA 3.0