0

I have an issue where BluetoothManager constantly shows the following message in LogCat, even after device Bluetooth has been turned off.

D/BluetoothManager: getConnectedDevices

This causes a problem when I try to search for new devices, the only way I can stop this is to 'force quit' the app. Please see what I have tried below, I've tried a few other things but nothing seems to work.

BluetoothManager btManager = (BluetoothManager) getSystemService(BLUETOOTH_SERVICE);
btManager.getAdapter().cancelDiscovery();

Also,

BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
mBluetoothAdapter.cancelDiscovery();

1 Answer 1

0

Can you add more code on how you are scanning for the devices?

On the Android Docs for BLE devices : https://developer.android.com/guide/topics/connectivity/bluetooth-le.html#find

You first need to create a BluetoothAdapter.LeScanCallback and then you can pass it to the bluetoothAdapter to start scan: bluetoothAdapter.startLeScan(leScanCallback); or to stop the scan: bluetoothAdapter.stopLeScan(leScanCallback);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.