(Source link: https://github.com/prl85/BLEScanner/)
iBeacon Scanner for Android 5.0 and later – resolves ‘5 tries per 30 seconds’ limit by Android 7.0 (Nougat) and later
To resolve the scan block problem by Android 7.0, my library (BLEScanner) did made some trick like following;
- Regardless of the requested period for scanning, BLEScanner performs BLE scan at least 6 seconds (30/5= 6 s)
- BLEScanner externally returns scan result of requested period like the scanning is performed during the period, but internally it continues to scan without reporting result
- If new scan is requested before BLE scan is terminated internally, BLEScanner returns scan results of new request period, and delays real BLE scan stop if necessary.
By separating result report period and real BLE scan stop timing, users can be perceived that the scan is performed during request period, while BLEScanner internally adjusts real BLE scan stop timing to cope with ‘5 tries per 30 seconds’ limit.