Issue:
When setting the app’s targetSdk is 30, and app running normal on Android 8, but running abnormal on Android 11
在扫描蓝牙广播时,收不到onScanResult的结果回调
Fix:
As we know, if we want to receive the advertising data, we should apply permission as below:
Manifest.permission.BLUETOOTH
Manifest.permission.BLUETOOTH_ADMIN
Manifest.permission.ACCESS_COARSE_LOCATION
But when the targetSdk is 30, we should add another permission:
Manifest.permission.ACCESS_FINE_LOCATION
It’s a new strategy on Android 11.
reference:
Before android 11:
/**
* Start Bluetooth LE scan with default parameters and no