Connecting bluetooth device to windows phone 8 application

2

I'm developing a Windows phone 8 OS application which should connect to the Bluetooth device (by id/ name).

I tried to use by PeerFinder.FindAllPeersAsync() to find all the active devices and I got the following error:

A method was called at an unexpected time. (Exception from HRESULT: 0x8000000E).

How can I connect to Bluetooth? What do I need to do?

Is it possible?

I need the answer ASAP.

Thank a lot

windows-phone-8
bluetooth
asked on Stack Overflow Dec 27, 2013 by user1801236 • edited Dec 27, 2013 by Asfab

2 Answers

1

Had the same problem and couldn't find anyone with a solution. After an hour or so of trial and error I have come up with the following:

  1. You need to call PeerFinder.Start() before PeerFinder.FindAllPeersAsync() or you will get the error "A method was called at an unexpected time" (which is caught in Microsoft's sample application "Bluetooth app to app sample" - ERR_NOT_ADVERTISING = 0x8000000E).

  2. But after saying all that I couldn't find any Bluetooth devices. The only way I worked out how to connect to a Bluetooth device was to pair using the control panel and then use PeerFinder.AlternateIdentities["Bluetooth:Paired"] = string.Empty; Now this didn't seem to require PeerFinder.Start() to return results but if you don't do it you will get exceptions later on.

I couldn't find information about this on the Microsoft API's - it seems like these API's are unpolished.

answered on Stack Overflow Dec 30, 2013 by Luke
0

WP8 supports the RFCOMM Bluetooth profile. This is a serial emulation profile. So in theory, any Bluetooth device that can be paired via RFCOMM should work.

Bluetooth for Windows Phone 8

Developer Code Samples (Phone + Bluetooth)


User contributions licensed under CC BY-SA 3.0