beacon_broadcast flutter软件包中的错误代码2是什么意思? [英] What does error code 2 in beacon_broadcast flutter package mean?

查看:84
本文介绍了beacon_broadcast flutter软件包中的错误代码2是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Flutter制作信标广播应用程序.我正在使用的库是pub.dev上的"beacon_broadcast".当我尝试启动它时,控制台会显示:

I am making a beacon broadcast app using Flutter. The library I am using is "beacon_broadcast" at pub.dev. When I try to start it, the console says:

D/BeaconParser( 7318): Parsing beacon layout: m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25
D/BluetoothAdapter( 7318): isLeEnabled(): ON
D/BluetoothAdapter( 7318): isLeEnabled(): ON
E/BeaconTransmitter( 7318): Advertisement start failed, code: 2

错误代码2是什么意思?我不需要任何其他帮助,我只需要含义,所以我认为不需要显示代码.

What does error code 2 mean? I don't need any other help, I just want the meaning, so I think I don't need to show the code.

此外,请尽可能添加错误代码和含义的列表.

Also, if possible, please add a list of error codes and meanings.

推荐答案

每个电话型号都有不同的蓝牙芯片,每个蓝牙芯片都支持有限数量的广告插槽".每个插槽都允许启动一个蓝牙LE广告.如果手机已经用完所有可用的广告位,则会出现此错误.

Every phone model has a different Bluetooth chip, each of which supports a limited number of "advertising slots". Each slot allows a single Bluetooth LE advertisement to be started. If the phone has already used all its available advertising slots, you get this error.

ADVERTISE_FAILED_TOO_MANY_ADVERTISERS
Added in API level 21
public static final int ADVERTISE_FAILED_TOO_MANY_ADVERTISERS
Failed to start advertising because no advertising instance is available.

Constant Value: 2 (0x00000002)

请参阅: https://developer.android.com/reference/android/bluetooth/le/AdvertiseCallback ,其中也列出了所有其他错误代码.

See: https://developer.android.com/reference/android/bluetooth/le/AdvertiseCallback which has a list of all the other error codes, too.

由于插槽是电话上的共享资源,因此其他应用可能正在使用某些插槽.Nexus 4等较旧的手机仅支持一个插槽.像Pixel 3a这样的较新手机支持10个或更多插槽.有些手机根本没有任何插槽.请参见不支持广告的设备列表.

Since the slots are a shared resource on the phone, it is possible that another app may be using some of the slots. Older phones like the Nexus 4 only supported one slot. Newer phones like the Pixel 3a support 10 or more slots. Some phones don't have any slots at all. See here for a list of devices with no advertising support.

每个电话OEM都实现了一部分蓝牙堆栈,该堆栈将硬件桥接到Android操作系统.这段代码几乎总是封闭源代码.取决于此OEM层的实施方式(以及正确性),它会影响可用的广告位数量.

Each phone OEM implements part of the bluetooth stack that bridges the hardware to the Android operating system. This code is almost always closed-source. Depending on how this OEM layer is implemented (and how correctly) it can affect how many advertising slots are available.

不幸的是,没有API可以查询手机理论上可用的广告位总数.如果没有OEM的源代码,唯一的办法就是在手机上恢复出厂设置(以确保没有安装其他应用程序正在使用插槽),然后构建一个尝试逐个启动一个广告客户的应用程序直到一个失败.

Unfortunately there are no APIs to query the total number of advertising slots that are in theory available on a phone. Without the source code from the OEM, the only way to tell is to do a factory reset on your phone (to be sure no other apps installed are using a slot), and build an app that tries to start one advertiser after another, counting up until one fails.

这篇关于beacon_broadcast flutter软件包中的错误代码2是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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