在没有 BluetoothManagerCallback 的情况下调用 getBluetoothService [英] getBluetoothService called with no BluetoothManagerCallback

查看:29
本文介绍了在没有 BluetoothManagerCallback 的情况下调用 getBluetoothService的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Android 应用程序中经常收到 getBluetoothService() 调用而没有 BluetoothManagerCallback 作为错误.

I am getting getBluetoothService() called with no BluetoothManagerCallback as an error frequently in my Android application.

我不知道是什么导致了这个或关于蓝牙管理器回调的任何事情.任何人都可以让我很好地了解可能导致此问题的原因或从哪里开始寻找.

I have no idea what is causing this or anything about bluetooth manager callbacks. Can anyone give me a good idea of what could be causing this problem or where to start looking.

推荐答案

通过阅读 Android 源代码,这似乎是一个警告,您无能为力.源代码显示,如果调用

By reading into the Android source code, it seems to be a warning you cannot do anything about. The source code shows that if you call

BluetoothSocket#connect();

然后它会调用

BluetoothAdapter.getDefaultAdapter().getBluetoothService(null);

这里的关键是它在上面的行中传递的空参数.因此,不会有回调,然后BluetoothSocket类会抛出警告.

The key here, is the null parameter that it passes in the above line. Due to this, there will be no callback, and then the BluetoothSocket class will throw out a warning.

由于这只是一个警告,我认为您不需要对此采取任何措施.

Since it is only a warning, I do not think you need to do anything about it.

https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/bluetooth/BluetoothSocket.java 第 306 行https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/bluetooth/BluetoothAdapter.java 第 1610 行

https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/bluetooth/BluetoothSocket.java line 306 https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/bluetooth/BluetoothAdapter.java line 1610

这篇关于在没有 BluetoothManagerCallback 的情况下调用 getBluetoothService的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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