0

The scenario is: 1. Turn on my Nokia Bluetooth BH-214. 2. Wait for connection eastablished with my Lumia 822. 3. run the code.

The exception is thrown from

await socket.ConnectAsync(selectedDevice.HostName, "1");

Message = "Only one usage of each socket address (protocol/network address/port) is normally permitted. (Exception from HRESULT: 0x80072740)"

Code: PeerFinder.AlternateIdentities["Bluetooth:Paired"] = ""; var pairedDevices = await PeerFinder.FindAllPeersAsync();

       if (pairedDevices.Count == 0)
       {
          Debug.WriteLine("No paired devices were found.");
       }
       else
       {
          // Select a paired device. In this example, just pick the first one.
          PeerInformation selectedDevice = pairedDevices[0];
          StreamSocket socket = new StreamSocket();
          try
          {
              await socket.ConnectAsync(selectedDevice.HostName, "1");
          }
          catch (Exception ee)
          {
          }
       }

Does that mean, if audio BT headset has been connected with native app, I can't connect with it? I have my own musicplayer and I want listen comments sent from BT headset for play/pause/FF/FW, that's all. Thanks!

thsieh
  • 620
  • 8
  • 24

1 Answers1

0

Yup, if the OS has connected to the Handsfree (etc) service then an app can't.

There's an API on desktop Windows to get 'media' player button presses, isn't it available on WP8? The OS takes the events from the Bluetooth handsfree/headset device etc and raises those event.

Or. Also on desktop Windows its possible in control panel and programmatically to enable/disable particular Bluetooth services on each device. Maybe that's available on WP8?

alanjmcf
  • 3,430
  • 1
  • 17
  • 14
  • What are the API looks like? Maybe I can do a search. Currently only events I get from MediaPlayer and MediaState are that the media is been stopped and playing in response to user's actions (FF/FR/Play/Pause). – thsieh Feb 05 '13 at 01:18