블루투스 스캔 호출 빈도가 짧은 시간 안에 너무 잦으면

ScanCallback() 에 어떤 onScanFailed, onScanResult, onBatchScanResults 도 호출되지 않는다.

로그 > status=6 은 

D/BluetoothAdapter: isLeEnabled(): ON
D/BluetoothLeScanner: onScannerRegistered() - status=6 scannerId=-1 mScannerId=0

 

ScanCallback.java

/**
  * Fails to start scan as application tries to scan too frequently.
  * @hide
  */
public static final int SCAN_FAILED_SCANNING_TOO_FREQUENTLY = 6;

 

 

방법 1. 스캔 호출하는 시간 간격을 늘려준다.

방법 2. address 나 uuid 를 알고 있다면 직접 접속으로 스캐닝과 병행하여 구현한다.

 

- 참조 링크

https://github.com/NordicSemiconductor/Android-Scanner-Compat-Library/issues/18#issuecomment-402412139

- 블루투스 도움되는 링크

NordicSemiconductor / Android-BLE-Library https://github.com/NordicSemiconductor/Android-BLE-Library.git

Making Android BLE work — part 1 by Martijn van Welie https://link.medium.com/jOoagTLCY4

+ Recent posts