Short answer: if an Android BLE scan finds nothing, check in this order: runtime permissions for your Android version, Location services (on Android 11 and lower), the device actually advertising, your scan filter, and Android’s scan throttling.
1. Permissions for your Android version
Android 12 (API 31) and higher need BLUETOOTH_SCAN granted at runtime. Android 11 and lower need a location permission. A missing permission gives you an empty result, not always an error.
2. Location services must be on (Android 11 and lower)
On older versions, scan results are not delivered when the system Location toggle is off, even if the permission is granted. Check it and prompt the user.
val lm = getSystemService(LocationManager::class.java)
val on = LocationManagerCompat.isLocationEnabled(lm)
3. Is the device really advertising?
Test with a generic scanner app. If it does not show your device either, the problem is the peripheral: it may be connected to another phone, asleep, or advertising only for a short window after a button press.
4. Loosen or fix your scan filter
A filter on a service UUID only matches devices that put that UUID in the advertising packet. Many devices only expose services after connecting. Try scanning with no filter once, or filter by device name or MAC address instead.
val filter = ScanFilter.Builder().setDeviceName("MY-DEVICE").build()
scanner.startScan(listOf(filter), settings, callback)
5. Scan throttling
Android limits how often an app can start scans. Starting and stopping more than about five times in 30 seconds makes later scans silently return nothing. Start one scan, keep it running while the user is on the screen, and stop it when done.
6. Handle scan failures
Override onScanFailed and log the error code. It tells you about throttling or internal errors instead of leaving you guessing.
override fun onScanFailed(errorCode: Int) {
Log.e("BLE", "Scan failed: $errorCode")
}
Checklist
- Right permissions requested at runtime.
- Location on (Android 11 and lower).
- Device visible in a generic scanner app.
- Filter matches the advertising packet.
- Not starting scans too often.
onScanFailedlogged.
FAQ
Why does BLE scanning need location on older Android?
Before Android 12, scan results could reveal location, so the system tied scanning to the location permission and toggle.
Why does my scan work in a scanner app but not mine?
Usually a permission, a filter that is too strict, or throttling from repeated starts.
Related: Android BLE Connection Problems: 7 Mistakes and Fixes.