return from scanning if permission is not granted

This commit is contained in:
Dorian Zedler 2020-10-18 03:32:39 +02:00
parent 35ff374658
commit fba59b3777
Signed by: dorian
GPG key ID: D3B255CB8BC7CD37

View file

@ -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;
}
}