Reedyuk / blue-falcon

A Bluetooth kotlin multiplatform "Cross-Platform" library for iOS and Android
https://bluefalcon.dev
Apache License 2.0
340 stars 45 forks source link

BluetoothGatt: android.os.DeadObjectException #56

Open PeterKucera opened 4 years ago

PeterKucera commented 4 years ago

Expected For creating a connection, I am using method connect() with autoConnect flag set to true. This is setup once and it is expected that after setting up this "autoConnect", there is no other action required and Android OS BLE stack will notify the app, once remote device becomes available, and this call will never time out.

Actual Sometimes, I can reproduce following behavior: App is capable of connecting to device, but when app attempts to write bytes, it results in following exception: "BluetoothGatt: android.os.DeadObjectException"

To Reproduce Steps to reproduce the behavior:

  1. call connect method with autoConnect flag set to true
  2. Wait a few hours
  3. After reconnection, writing to device will always result in "BluetoothGatt: android.os.DeadObjectException"

Note: Even restarting the BT module will not solve the issue. What will solve the issue is reinitialising BlueFalcon library.

Smartphone (please complete the following information):