diff --git a/android/src/main/java/com/reactbolt/sdk/RNBoltReactLibraryModule.java b/android/src/main/java/com/reactbolt/sdk/RNBoltReactLibraryModule.java index 2b77001..fcd0322 100644 --- a/android/src/main/java/com/reactbolt/sdk/RNBoltReactLibraryModule.java +++ b/android/src/main/java/com/reactbolt/sdk/RNBoltReactLibraryModule.java @@ -364,7 +364,12 @@ public Boolean checkPermission() { ); if (currentVer >= 31 && hasPermission) { - hasPermission = (hasPermission && ContextCompat.checkSelfPermission(context, "android.permission.BLUETOOTH_CONNECT") == PackageManager.PERMISSION_GRANTED); + hasPermission = (hasPermission && + ContextCompat.checkSelfPermission(context, "android.permission.BLUETOOTH") == PackageManager.PERMISSION_GRANTED && + ContextCompat.checkSelfPermission(context, "android.permission.BLUETOOTH_ADMIN") == PackageManager.PERMISSION_GRANTED && + ContextCompat.checkSelfPermission(context, "android.permission.BLUETOOTH_CONNECT") == PackageManager.PERMISSION_GRANTED && + ContextCompat.checkSelfPermission(context, "android.permission.BLUETOOTH_SCAN") == PackageManager.PERMISSION_GRANTED + ); } return hasPermission; @@ -385,7 +390,10 @@ public void requestPermission() { if (currentVer >= 31) { // there doesn't seem to be a constant for this (i.e. Manifest.permission.BLUETOOTH_CONNECT) -- kept getting compiler errors // but using the permission string directly seems to work + permissions.add("android.permission.BLUETOOTH"); + permissions.add("android.permission.BLUETOOTH_ADMIN"); permissions.add("android.permission.BLUETOOTH_CONNECT"); + permissions.add("android.permission.BLUETOOTH_SCAN"); } String[] array = permissions.toArray(new String[permissions.size()]);