Skip to content

Commit af963e3

Browse files
committed
fix(android): correctly check for ermission
1 parent c7d4d3e commit af963e3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/bluetooth.android.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,10 +1130,11 @@ export class Bluetooth extends BluetoothCommon {
11301130
if (!hasPermission) {
11311131
const ctx = this._getContext();
11321132
// CLog(CLogTypes.info, 'app context', ctx);
1133+
const neededPermision = getAndroidSDK() < 29 ? android.Manifest.permission.ACCESS_COARSE_LOCATION : android.Manifest.permission.ACCESS_FINE_LOCATION;
11331134

1134-
hasPermission = android.content.pm.PackageManager.PERMISSION_GRANTED === androidx.core.content.ContextCompat.checkSelfPermission(ctx, android.Manifest.permission.ACCESS_FINE_LOCATION);
1135+
hasPermission = android.content.pm.PackageManager.PERMISSION_GRANTED === androidx.core.content.ContextCompat.checkSelfPermission(ctx, neededPermision);
1136+
CLog(CLogTypes.info, `coarseLocationPermissionGranted ---- ${neededPermision} permission granted?`, hasPermission);
11351137
}
1136-
CLog(CLogTypes.info, 'coarseLocationPermissionGranted ---- ACCESS_FINE_LOCATION permission granted?', hasPermission);
11371138
return hasPermission;
11381139
}
11391140

0 commit comments

Comments
 (0)