Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

509
Visualizações
Android 12 BLUETOOTH_CONNECT permission is granted when denied

So I know Android 12 has new Bluetooth permissions. In the App Info Permissions it looks like its called Nearby Devices now. I have this logic:

        if (ContextCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED) {
            viewModel.connectDevice(macAddressDropdown.selectedItem.toString())
        } else {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
                ActivityCompat.requestPermissions(
                    this,
                    arrayOf(Manifest.permission.BLUETOOTH_CONNECT),
                    1
                )
            }
        }
    }

On initial launch, this seems to work fine, it will prompt for the Nearby Device permission as it looks on the Google documentation. After this, I go into the Permissions in App Info, and I deny the Nearby Devices permission. When I debug this logic, it is saying BLUETOOTH_CONNECT is still allowed.

s = ContextCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED
a = ContextCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_SCAN) == PackageManager.PERMISSION_GRANTED
b = ContextCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH) == PackageManager.PERMISSION_GRANTED
c = ContextCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_ADMIN) == PackageManager.PERMISSION_GRANTED
d = ContextCompat.checkSelfPermission(this, Manifest.permission_group.NEARBY_DEVICES) == PackageManager.PERMISSION_GRANTED

When I debug this, BLUETOOTH_CONNECT is the only one showing as true, the rest are false. Any ideas on why this is happening and how it can be fixed? Potentially a bug? Thanks

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I encountered the same issue with

minSdkVersion 21
targetSdkVersion 30
compileSdkVersion 31

changing the target version to 31 fix it for me

minSdkVersion 21
targetSdkVersion 31
compileSdkVersion 31
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda