Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Nearby Connections 2.0 sometime ask for Bluetooth pairing PIN number

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:

  1. Only one device has a pop-up dialog asking for pin. Enter any data or dismiss the dialog will cause the connection to fail

  2. 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.

like image 322
user1416682 Avatar asked Aug 16 '17 10:08

user1416682


1 Answers

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:

  1. Non Bluetooth-BLE devices
  2. Bluetooth-BLE but does not support BLE Advertising with API level 21
  3. Bluetooth-BLE with proper support of BLE Advertising with API level 21

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.

like image 137
user1416682 Avatar answered Nov 14 '22 04:11

user1416682