Connecting a bluetooth device to the phone window 8 applications

I am developing an application for Windows 8 for an OS that should connect to a Bluetooth device (by id / name).

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

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

How to connect to bluetooth? What do I need to do?

Is it possible?

I need an answer as soon as possible.

Thank you very much

+2
source share
2 answers

Had the same problem and could not find anyone with a solution. After an hour or so of trial and error, I came up with the following:

  • You need to call PeerFinder.Start () before PeerFinder.FindAllPeersAsync () or you get the error message “The method was called unexpectedly” (which got into the Microsoft application “Bluetooth application for the sample application - ERR_NOT_ADVERTISING = 0x8000000E).

  • But after I said everything, I could not find any Bluetooth devices. The only way I worked on how to connect to a Bluetooth device was to set the pair using the control panel and then use PeerFinder.AlternateIdentities ["Bluetooth: Steam"] = string.Empty; Now, it seems that PeerFinder.Start () does not need to return results, but if you do not, you will get exceptions later.

I could not find information about this in the Microsoft API - it looks like these APIs were not polished.

+1
source

WP8 supports the RFCOMM Bluetooth profile. This is a sequential emulation profile. Therefore, theoretically, any Bluetooth device that can be paired with RFCOMM should work.

Bluetooth for Windows Phone 8

Developer Code Examples (Phone + Bluetooth)

0
source

Source: https://habr.com/ru/post/1447440/


All Articles