return from scanning if permission is not granted
This commit is contained in:
parent
35ff374658
commit
fba59b3777
1 changed files with 2 additions and 1 deletions
|
@ -36,7 +36,7 @@ bool QBluetoothLeUartClient::startScanningForDevices(){
|
|||
#ifdef Q_OS_ANDROID
|
||||
else if(this->state == LocationPermissionDenied) {
|
||||
// try to get permission
|
||||
QtAndroid::PermissionResultMap resultMap = QtAndroid::requestPermissionsSync({"android.permission.ACCESS_FINE_LOCATION", "android.permission.ACCESS_COARSE_LOCATION"}, 5000);
|
||||
QtAndroid::PermissionResultMap resultMap = QtAndroid::requestPermissionsSync({"android.permission.ACCESS_FINE_LOCATION", "android.permission.ACCESS_COARSE_LOCATION"});
|
||||
bool resultBool = true;
|
||||
for(QtAndroid::PermissionResult result : resultMap) {
|
||||
if(result != QtAndroid::PermissionResult::Granted) {
|
||||
|
@ -47,6 +47,7 @@ bool QBluetoothLeUartClient::startScanningForDevices(){
|
|||
|
||||
if(!resultBool) {
|
||||
emit this->scanningErrorOccured(LocationPermissionDeniedError);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue