How to scan only Advertising Packet BLE

1.1k views Asked by At

While scanning for advertising beacons with startLeScan method, this method also request peripheral device for scan response and stores it in scanRecord. I only want to scan for advertising payload I don’t want to send request scan response to peripheral device

my code to scan:

mBluetoothAdapter.startLeScan(mLEScanCallback);
private BluetoothAdapter.LeScanCallback mLEScanCallback = new BluetoothAdapter.LeScanCallback() {
    @Override
    public void onLeScan(BluetoothDevice device, int rssi, byte[] scanRecord) {

    }
};
1

There are 1 answers

0
davidgyoung On BEST ANSWER

No, I do not believe there is any way to turn off scan response requests. Android 4.3-4.4 BLE APIs provide no scanning options at all (other than a service uuid filter). The new Android 5.0 APIs have added some scan options, but none that halt scan responses. See here:

https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder.html