Closed XXXXzzzz000 closed 1 year ago
What is the device model and android version? Did you check if bluetooth and location service are enable?
now
config.uuid = null
and it will start ,but can't scan device. the callback
override fun onDeviceDiscovered(device: BluetoothDevice, rssi: Int) {
if(device.name=="test_device")
{
showToast("connect ${device.name},${device.uuids}");
bt_device=device;
mservice!!.connect(device) // See also service.disconnect();
}
else
{
showToast(device.name);
}
}
wasn't invoke
device: one plus 3t android version :android 8.0
embedded device : esp32
bluetooth is enable . location service should be add into manifest? or i need open location service?
config.uuid
is required for the classic mode.
You need to make sure if the location service is enable: know issue.
Now I solved these problems .
The UUID passed here must match the UUID that the server device uses to open its BluetoothServerSocket with listenUsingRfcommWithServiceRecord(String, UUID) . To use the same UUID, simply encode the UUID string into the application and then reference the string through the server code and client code.
and thanks for your help! @douglasjunior
您的邮件我已收到。 宣泽
when i start scan it will stop immediately.
it work should like : button down->start scan->find device name "test device"->connect
but when i press button ,i will see start scan and stop scan immediately