streamsocket.connectasync results in access denied exception from hresult: 0x80070005 on windows phone 8.1?

0

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");
        ...
sockets
networking
bluetooth
windows-phone-8.1
access-denied
asked on Stack Overflow Aug 25, 2015 by Zaid Dreakh • edited Apr 6, 2020 by Quality Catalyst

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0