简体   繁体   English

Google Nearby Connections 2.0有时会要求蓝牙配对密码

[英]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. 在自动模式下使用示例步话机程序测试Google Nearby Connections 2.0时,有时设备会询问蓝牙配对密码。 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. Senario 1更经常发生。

How can I avoid this problem? 我该如何避免这个问题? I can not find any information on the Nearby Connections 2.0 SDK documentation. 我找不到有关Nearby Connections 2.0 SDK文档的任何信息。

I am also seeing this error in my own app, which uses Google Nearby Connections 2.0. 我也在自己的应用程序中看到此错误,该应用程序使用Google Nearby Connections 2.0。 The "walkie-talkie" sample program uses the P2P "star" strategy, whereas my app uses the P2P "cluster" strategy. “对讲机”示例程序使用P2P“星”策略,而我的应用程序使用P2P“集群”策略。 Therefore, we can see that the problem occurs in both cases. 因此,我们可以看到在两种情况下都会出现问题。 I would like to know: 我想知道:
(1) What causes this error? (1)导致此错误的原因是什么?
(2) What (if anything) can the app receiving the error do to remedy it? (2)接收错误的应用程序可以做什么(如果有的话)来解决它?
(3) If something needs to be done to the physical devices in this situation, what would be a reasonable message to tell the user? (3)如果在这种情况下需要对物理设备进行某些操作,告诉用户什么是合理的消息?

I have found very little good technical documentation about error conditions in Nearby Connections 2.0, and would very much like to see some. 我在Nearby Connections 2.0中找到了关于错误条件的非常好的技术文档,并且非常希望看到一些。 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. 经过一些测试,我相信这个问题与BLE广告功能有关。 Here is what I did to minimize the problem: 以下是我为减少问题所做的工作:

We can roughly group android devices into three groups: 我们可以将Android设备大致分为三组:

  1. Non Bluetooth-BLE devices 非蓝牙BLE设备
  2. Bluetooth-BLE but does not support BLE Advertising with API level 21 Bluetooth-BLE但不支持API级别为21的BLE广告
  3. Bluetooth-BLE with proper support of BLE Advertising with API level 21 Bluetooth-BLE,具有API级别21的BLE广告的适当支持

When using Nearby Connections 2.0: 使用Nearby Connections 2.0时:

Group 1 is only good for searching and link with device that is advertising 第1组仅适用于搜索和链接广告设备

Group 2 can do advertising, but it is difficult to judge how reliable it is 第2组可以做广告,但很难判断它是多么可靠

Group 3 probably offer more reliable performance 第3组可能提供更可靠的性能

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. 对于使用Nearby Connections 2.0的人,我建议您找出您的设备属于哪三个组。 Using group 3 devices is preferable and minimize problem with Bluetooth. 使用第3组设备是最好的,并将蓝牙问题降至最低。

PS: Always read Google announcement with caution. PS:请务必谨慎阅读Google公告。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM