Tôi đang cố gắng để kết nối Nexus 4 với một Wii Balance Board nhưng tôi nhận được lỗi này:Android: getBluetoothService() gọi mà không có BluetoothManagerCallback
getBluetoothService() called with no BluetoothManagerCallback
connect(), SocketState: INIT, mPfd: null
Vì vậy, nó không hoàn thành kết nối.
ổ cắm của tôi:
public final class wSocket
{
public static BluetoothSocket create(BluetoothDevice dev, int port)
{
try {
/*
* BluetoothSocket(int type, int fd, boolean auth, boolean encrypt, BluetoothDevice device, int port, ParcelUuid uuid)
*/
Constructor<BluetoothSocket> construct = BluetoothSocket.class.getDeclaredConstructor(int.class, int.class, boolean.class,
boolean.class, BluetoothDevice.class, int.class, ParcelUuid.class);
construct.setAccessible(true);
return construct.newInstance(3 /* TYPE_L2CAP */, -1, false, false, dev, port, null);
} catch (Exception ex) {
return null;
}
}
}
đâu nó mang lại cho tôi những lỗi:
private BluetoothSocket sk;
...
sk = wSocket.create(wm.dev, 0x11);
...
sk.connect();
Tôi đã kiểm tra liên kết này không thành công vì tôi chỉ cần mở 1 ổ cắm: getbluetoothservice() called with no bluetoothmanagercallback
Bất kỳ giúp đỡ hoặc ý tưởng để khám phá?
Bạn đang sử dụng phiên bản Android nào? Tôi cũng nhận được lỗi này ngay lập tức, nhưng chưa bao giờ có nó trước đây. –
Tôi vừa mới bắt đầu thấy lỗi này trên Android 4.4. Tôi đã thực hiện rất nhiều công việc với Bluetooth trên nhiều loại thiết bị, mặc dù chủ yếu là 2.x và 3.x. –