0

I am trying to build an app which uses BLE. I am testing this app on a Samsung Galaxy S5 running Android 5.0.1. When I try to scan for bluetooth devices I immediately get this in the log:

03-25 17:39:41.235 2696-2714/com.example.multiplayertest D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=7
03-25 17:39:41.245 2696-2696/com.example.multiplayertest I/System.out: -99
03-25 17:39:41.245 2696-2696/com.example.multiplayertest I/System.out: failed

The scan fails immediately with error code -99. I have not been able to find what this means anywhere and any help you can give would be appreciated.

Scanning Code:

    final BluetoothLeScanner scanner = bluetoothAdapter.getBluetoothLeScanner();
    final ArrayList<ScanFilter> filterList = new ArrayList<>();

    ScanFilter.Builder scanBuilder = new ScanFilter.Builder();
    scanBuilder.setServiceUuid(new ParcelUuid(serviceUuid));
    filterList.add(scanBuilder.build());

    ScanSettings.Builder settingsBuilder = new ScanSettings.Builder();
    settingsBuilder.setScanMode(ScanSettings.SCAN_MODE_BALANCED);

    scanner.startScan(filterList, settingsBuilder.build(), scanCallback);

And scanCallback:

ScanCallback scanCallback = new ScanCallback() {
    @Override
    public void onScanResult(int callbackType, ScanResult result) {
        super.onScanResult(callbackType, result);
        System.out.println("Result");
    }

    @Override
    public void onBatchScanResults(List<ScanResult> results) {
        super.onBatchScanResults(results);
        System.out.println("Results");

    }

    @Override
    public void onScanFailed(int errorCode) {
        super.onScanFailed(errorCode);
        System.out.println(errorCode);
        System.out.println("failed");

    }
};
DHerls
  • 827
  • 9
  • 21

0 Answers0