错误“扫描失败,无法注册应用"在AltBeacon库中扫描信标时 [英] Error "Scan failed, app cannot be registered" in scanning beacons in AltBeacon library

查看:380
本文介绍了错误“扫描失败,无法注册应用"在AltBeacon库中扫描信标时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android设备上测距信标时,一段时间(约3-5分钟)后会发生错误.此后,测距不再会看到信标. 它仅有助于重启蓝牙.重新启动后,测距开始正常工作,可以检测到信标,但过一会儿,再次发生故障. 据我了解,客户端连接溢出. 我学习了logcat并确定了以下错误:

When ranging beacons on an android device, an error occurs after some time (about 3-5 minutes). After this, the ranging no longer sees the beacons. It helps only reboot the Bluetooth. After rebooting the ranging starts working normally, the beacons are detected, but after a while, the failure again occurs. As far as I understand, client connections overflow. I learned logcat and determined the following errors:

GATT_Register:无法注册GATT客户端,已达到MAX客户端! CycledLeScannerForLollipop扫描失败:无法注册应用 BluetoothLeScanner onClientRegistered()-状态= 133个客户端如果= 0 mClientIf = 0

GATT_Register: can not Register GATT client, MAX client reached! CycledLeScannerForLollipop Scan failed:app cannot be registered BluetoothLeScanner onClientRegistered () - status = 133 clientIf = 0 mClientIf = 0

我对状态的了解程度应该为0. 我再次指出,这项工作的功能是在与应用程序本身不同的进程中运行的服务. 服务停止看到信标时,带有BluetoothLeScanner过滤器的logcat字符串:

How much I understand status should be 0. I note once again that the feature of the work is a service that runs in a separate process from the application itself. Strings from logcat with the BluetoothLeScanner filter at the moment when the service stops seeing the beacons:

    Debug   12591   BluetoothLeScanner  onClientRegistered() - status=133 clientIf=0 mClientIf=0
Debug   12591   BluetoothLeScanner  onClientRegistered() - status=133 clientIf=0 mClientIf=0
Debug   12591   BluetoothLeScanner  onClientRegistered() - status=133 clientIf=0 mClientIf=0
Debug   12591   BluetoothLeScanner  onClientRegistered() - status=133 clientIf=0 mClientIf=0
Debug   12591   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=32 mClientIf=0
Debug   12591   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=32 mClientIf=0
Debug   12591   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=31 mClientIf=0
Debug   12591   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=30 mClientIf=0
Debug   12591   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=29 mClientIf=0
Debug   12591   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=28 mClientIf=0

有可能解决给定的问题吗?谢谢!

It is possible as that to solve the given problem? Thank you!

这是logcat:

This is logcat:

  Time           Device Name  Type     PID           Tag          Message
02-19 18:49:45.395  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=133 clientIf=0 mClientIf=0
02-19 18:49:40.375  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=32 mClientIf=0
02-19 18:49:35.333  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=31 mClientIf=0
02-19 18:49:30.411  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=30 mClientIf=0
02-19 18:49:25.256  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=29 mClientIf=0
02-19 18:49:20.234  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=28 mClientIf=0
02-19 18:49:15.185  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=27 mClientIf=0
02-19 18:49:10.181  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=5 mClientIf=0
02-19 18:49:05.170  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=26 mClientIf=0
02-19 18:49:00.124  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=26 mClientIf=0
02-19 18:48:55.108  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=25 mClientIf=0
02-19 18:48:50.078  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=25 mClientIf=0
02-19 18:48:45.028  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=23 mClientIf=0
02-19 18:48:39.992  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=24 mClientIf=0
02-19 18:48:39.316  AGM A8  Debug   3254    BluetoothLeScanner  onClientRegistered() - status=0 clientIf=23 mClientIf=0
02-19 18:48:34.994  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=22 mClientIf=0
02-19 18:48:29.927  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=21 mClientIf=0
02-19 18:48:24.905  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=20 mClientIf=0
02-19 18:48:19.866  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=19 mClientIf=0
02-19 18:48:14.852  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=18 mClientIf=0
02-19 18:48:09.825  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=17 mClientIf=0
02-19 18:48:04.812  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=16 mClientIf=0
02-19 18:47:59.768  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=15 mClientIf=0
02-19 18:47:54.751  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=14 mClientIf=0
02-19 18:47:49.708  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=13 mClientIf=0
02-19 18:47:44.688  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=12 mClientIf=0
02-19 18:47:39.676  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=11 mClientIf=0
02-19 18:47:34.662  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=10 mClientIf=0
02-19 18:47:29.603  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=9 mClientIf=0
02-19 18:47:24.585  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=8 mClientIf=0
02-19 18:47:19.552  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=7 mClientIf=0
02-19 18:47:14.525  AGM A8  Debug   13351   BluetoothLeScanner  onClientRegistered() - status=0 clientIf=7 mClientIf=0

推荐答案

在某些Android设备型号上,蓝牙协议栈可能会进入不良状态,需要重启电源才能使其能够再次扫描蓝牙设备.为了自动解决此问题,已 BluetoothMedic 已添加到Android Beacon库,该库会在检测到问题时自动重启蓝牙.在撰写本文时,此更改仍在请求请求中,因此尚未合并到该库的发行版中.

On some Android device models, the Bluetooth stack can get into a bad state requiring a power cycle to make it able to scan for bluetooth devices again. In order to automate a fix for this problem, a BluetoothMedic has been added to the Android Beacon Library which will automatically power cycle bluetooth when a problem is detected. As of this writing, this change is still in a pull request so not yet merged into a release build of the library.

尽管这是解决问题的方法,但核心问题可能是您的手机上安装了太多的蓝牙扫描应用程序. Android将同时使用Bluetooth客户端的应用程序数量限制为32个.如果安装的应用程序数量超过尝试使用Bluetooth LE API的应用程序数量,则会收到此错误消息,并且只会重启蓝牙(可能会自动重启)通过上述BluetoothMedic)可以从问题中恢复.这样可以有效地禁止在其他应用程序上使用蓝牙API,因此您的应用程序就有机会使用它们.

While this is a workaround for your problem, the core issue is probably that you have too many Bluetooth scanning apps installed on your phone. Android limits the number of apps simultaneously using a Bluetooth client to 32. If you have more than that many apps installed that are trying to use Bluetooth LE APIs, you will get this error, and only a power cycle of bluetooth (which may be automated by the BluetoothMedic above) can recover from the problem. This will effectively kill the use of the bluetooth APIs on the other apps so your app has a chance to use them.

这篇关于错误“扫描失败,无法注册应用"在AltBeacon库中扫描信标时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆