During testing of Google Nearby Connections 2.0 using the sample walkie-talkie program in automatic mode, sometimes the device will ask for Bluetooth pairing pin number. I have seen two scenarios:
Only one device has a pop-up dialog asking for pin. Enter any data or dismiss the dialog will cause the connection to fail
Both devices have pop-up dialogs. One to ask for setting up pin and other ask to enter the pin. After pin has been entered, the connection was a success.
Senario 1 happens more often.
How can I avoid this problem? I can not find any information on the Nearby Connections 2.0 SDK documentation.
I am also seeing this error in my own app, which uses Google Nearby Connections 2.0. The "walkie-talkie" sample program uses the P2P "star" strategy, whereas my app uses the P2P "cluster" strategy. Therefore, we can see that the problem occurs in both cases. I would like to know:
(1) What causes this error?
(2) What (if anything) can the app receiving the error do to remedy it?
(3) If something needs to be done to the physical devices in this situation, what would be a reasonable message to tell the user?
I have found very little good technical documentation about error conditions in Nearby Connections 2.0, and would very much like to see some. Therefore, even if nobody is able to answer this specific question directly, I will consider awarding the bounty to the best answer that provides other technical information about Nearby Connections errors.
After some testing, I believe this problem is related to BLE advertising function. Here is what I did to minimize the problem:
We can roughly group android devices into three groups:
When using Nearby Connections 2.0:
Group 1 is only good for searching and link with device that is advertising
Group 2 can do advertising, but it is difficult to judge how reliable it is
Group 3 probably offer more reliable performance
For people who is working with Nearby Connections 2.0, I suggest that you find out which of the three groups that your devices belong to. Using group 3 devices is preferable and minimize problem with Bluetooth.
PS: Always read Google announcement with caution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With