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
|
#ifdef Q_OS_ANDROID
|
||||||
else if(this->state == LocationPermissionDenied) {
|
else if(this->state == LocationPermissionDenied) {
|
||||||
// try to get permission
|
// 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;
|
bool resultBool = true;
|
||||||
for(QtAndroid::PermissionResult result : resultMap) {
|
for(QtAndroid::PermissionResult result : resultMap) {
|
||||||
if(result != QtAndroid::PermissionResult::Granted) {
|
if(result != QtAndroid::PermissionResult::Granted) {
|
||||||
|
@ -47,6 +47,7 @@ bool QBluetoothLeUartClient::startScanningForDevices(){
|
||||||
|
|
||||||
if(!resultBool) {
|
if(!resultBool) {
|
||||||
emit this->scanningErrorOccured(LocationPermissionDeniedError);
|
emit this->scanningErrorOccured(LocationPermissionDeniedError);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue