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

314
Visualizações
BLE : onConnectionStateChange Status 8 on Samsung phones

I am developing a heart rate monitoring app where I am reading data from BLE device, for all other phones there is no issue but for Samsung mobile like Note 8, which uses Bluetooth version 5.0 It is auto disconnect after some time and I am getting status 8

Code :

For connect

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
      mGattClient = device.connectGatt(this, false, mGattCallbacks, TRANSPORT_LE)
    } else {
      mGattClient = device.connectGatt(this, false, mGattCallbacks)
    }

// Connection state change

override fun onConnectionStateChange(gatt: BluetoothGatt, status: Int, newState: Int) {
      when (newState) {
        BluetoothProfile.STATE_CONNECTED -> {
//           this sleep is here to avoid TONS of problems in BLE, that occur whenever we start
//           service discovery immediately after the connection is established
           mGattClient?.discoverServices()
        }
        BluetoothProfile.STATE_DISCONNECTED -> {
          Log.d(TAG,"Disconnected status"+ status)
        }
      }
    }

    // New services discovered
    override fun onServicesDiscovered(gatt: BluetoothGatt, status: Int) {
      when (status) {
        BluetoothGatt.GATT_SUCCESS -> mListener?.deviceConnected(MESSAGE_CONNECTED, status)
        else -> Log.w("BLE", "onServicesDiscovered received: $status")
      }
    }

I have posted this on google issue tracker

https://issuetracker.google.com/issues/122856771

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

0

This issue has nothing to do with Android OS itself or your software. The error code 8 means Connection Timeout according to the Bluetooth specification. It means the Bluetooth hardware in the phone lost connection to the device. There are mainly three reasons: bad antenna / radio reception, clock drift between the two devices so they lose synchronization, too many scheduling conflicts (if you have multiple connections).

Is you experience that your Note 8 has significantly worse performance than other phones, send an issue report to Samsung.

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