在没有BluetoothManagerCallback的情况下调用了getBluetoothService [英] getBluetoothService called with no BluetoothManagerCallback
问题描述
在我的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);
此处的键是它在上一行中传递的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 line 306 https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/bluetooth/BluetoothAdapter.java line 1610
这篇关于在没有BluetoothManagerCallback的情况下调用了getBluetoothService的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!