polarofficial / polar-ble-sdk

Repository includes SDK and code examples. More info https://polar.com/en/developers
Other
449 stars 147 forks source link

Polar H10 - Android - PolarBleApi callback functions are not getting called #354

Closed teunklijn closed 1 year ago

teunklijn commented 1 year ago

Platform on which you observed the bug:

Device on which you observed the bug:

Describe the bug I'm connecting to the Polar H10 on a OnePlus 8T with Android 13. The connection proces completes correctly, but only some of the PolarBleApi callback functions are ever called when we auto connect. disInformationReceived, batteryLevelReceived, polarFtpFeatureReady and hrNotificationReceived are never called it seems like. We are initializing the api with the required services. We see the same behavior when we run the example app.

How to Reproduce

  1. Run the latest example app
  2. Connect to a Polar H10
  3. Check the logs to see if the disInformationReceived or batteryLevelReceived callbacks are called.

Expected behavior The logs show "DIS INFO uuid..." and "BATTERY LEVEL:...."

Connection Log

E/ATR     (16796): BDScanCallback/commandState state:IDLE action: CLIENT_START_SCAN
E/ATR     (16796): BDScanCallback/commandState state:IDLE action: EXIT
E/ATR     (16796): BDScanCallback/commandState state:SCANNING action: ENTRY
E/ATR     (16796): BDScanCallback/timestamps left: 0
E/ATR     (16796): BDScanCallback/Scan started -->
D/BluetoothAdapter(16796): isLeEnabled(): ON
D/BluetoothLeScanner(16796): onScannerRegistered() - status=0 scannerId=7 mScannerId=0
E/ATR     (16796): BDScanCallback/Scan started <--
E/ATR     (16796): BleGattBase/Added notification characteristic for fb005c51-02e7-f387-1cad-8acd2d8df0c8
E/ATR     (16796): BleGattBase/Added notification characteristic for fb005c52-02e7-f387-1cad-8acd2d8df0c8
E/ATR     (16796): BleGattBase/Added notification characteristic for 00002a19-0000-1000-8000-00805f9b34fb
E/ATR     (16796): BDDeviceListenerImpl/new device allocated name: Polar H10 7898EB2B
E/ATR     (16796): BDDeviceList/new session added: Polar H10 7898EB2B
E/ATR     (16796): BDScanCallback/commandState state:SCANNING action: CLIENT_REMOVED
E/ATR     (16796): BDScanCallback/commandState state:SCANNING action: EXIT
E/ATR     (16796): BDScanCallback/Stop scanning
D/BluetoothAdapter(16796): isLeEnabled(): ON
E/ATR     (16796): BDScanCallback/commandState state:IDLE action: ENTRY
E/ATR     (16796): ConnectionHandler/state: CONNECTING action: ENTRY
E/ATR     (16796): BDScanCallback/commandState state:IDLE action: ADMIN_STOP_SCAN
E/ATR     (16796): BDScanCallback/commandState state:IDLE action: EXIT
E/ATR     (16796): BDScanCallback/commandState state:STOPPED action: ENTRY
E/ATR     (16796): ConnectionHandler/ Session update from: SESSION_CLOSED to: SESSION_OPENING
E/ATR     (16796): BDScanCallback/commandState state:STOPPED action: CLIENT_REMOVED
D/BluetoothGatt(16796): connect() - device: E2:F5:C1:C4:7D:21, auto: false, eattSupport: false
D/BluetoothGatt(16796): registerApp()
D/BluetoothGatt(16796): registerApp() - UUID=4c769710-63f1-444c-907f-243006e55aca
E/ATR     (16796): auto connect search complete
D/BluetoothGatt(16796): onClientRegistered() - status=0 clientIf=7
D/BluetoothGatt(16796): onClientConnectionState() - status=0 clientIf=7 device=E2:F5:C1:C4:7D:21
E/ATR     (16796): GattCallback/GATT state changed device newState: 2 status: 0
D/BluetoothGatt(16796): onConnectionUpdated() - Device=E2:F5:C1:C4:7D:21 interval=6 latency=0 timeout=500 status=0
E/ATR     (16796): ConnectionHandler/state: CONNECTING action: DEVICE_CONNECTION_INITIALIZED
D/BluetoothGatt(16796): onPhyUpdate() - status=0 address=E2:F5:C1:C4:7D:21 txPhy=2 rxPhy=2
E/ATR     (16796): GattCallback/ phy updated tx: 2 rx: 2 status: 0
E/ATR     (16796): ConnectionHandler/state: CONNECTING action: PHY_UPDATED
D/BluetoothGatt(16796): configureMTU() - device: E2:F5:C1:C4:7D:21 mtu: 512
E/ATR     (16796): ConnectionHandler/state: CONNECTING action: MTU_UPDATED
D/BluetoothGatt(16796): discoverServices() - device: E2:F5:C1:C4:7D:21
E/ATR     (16796): ConnectionHandler/state: CONNECTING action: SERVICES_DISCOVERED
E/ATR     (16796): ConnectionHandler/ Session update from: SESSION_OPENING to: SESSION_OPEN
E/ATR     (16796): BDScanCallback/commandState state:STOPPED action: CLIENT_REMOVED
E/ATR     (16796): BDScanCallback/commandState state:STOPPED action: CLIENT_START_SCAN
E/ATR     (16796): ConnectionHandler/state: CONNECTING action: EXIT
E/ATR     (16796): BDScanCallback/commandState state:STOPPED action: ADMIN_START_SCAN
E/ATR     (16796): BDScanCallback/commandState state:STOPPED action: EXIT
E/ATR     (16796): BDScanCallback/commandState state:IDLE action: ENTRY
E/ATR     (16796): BDScanCallback/commandState state:IDLE action: EXIT
E/ATR     (16796): BDScanCallback/commandState state:SCANNING action: ENTRY
E/ATR     (16796): BDScanCallback/timestamps left: 1
E/ATR     (16796): BDScanCallback/Scan started -->
D/BluetoothAdapter(16796): isLeEnabled(): ON
D/BluetoothLeScanner(16796): onScannerRegistered() - status=0 scannerId=9 mScannerId=0
E/ATR     (16796): BDScanCallback/Scan started <--
JOikarinen commented 1 year ago

Hi @teunklijn

There are known problems with Android 13 and H10.

Here is the official statement related to H9 and H10 and Android13 compatibility issues:

"We are sorry to hear about this trouble with your heart rate sensor. The issue seems to be caused by the recent Android 13 update, and we are aware that the problem has been fixed already to certain phones like Samsung and Google Pixel, so please check first if there's a newer Android version available for your phone. It might solve the issue you’re experiencing. Despite of this, our team at Polar has been working on a solution for this issue as well to ensure all our customers get their sensors back to work with the Android 13, and therefore we will release a new firmware version for our heart rate sensors. The date is yet to be confirmed, but you will be notified about the update availability via Polar Flow and Beat apps and at the Updates at support.polar.com."

JOikarinen commented 1 year ago

Also reported in #350