if your bluetooth is on then give runtime permission of , ACCESS_FINE_LOCATION and ACCESS_CORSE_LOCATION and still you are facing this issue then gps on and restart scanning its working fine.
Required permission for BLE,
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
and check gps is enable or not
private fun enableLocation(): Boolean {
val service = activity?.getSystemService(Context.LOCATION_SERVICE) as LocationManager
val enabled = service.isProviderEnabled(LocationManager.GPS_PROVIDER)
return enabled
}
and if return false then
val intent = Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS)
startActivity(intent)
for enable your gps progrmatically and if true then scan your device.