Data Loss in BLE Communication between Unity and Android Library Integration

I have developed an Android library for BLE (Bluetooth Low Energy) communication intended for integration into Unity Android applications. However, I am encountering a notable issue of data loss during communication. It’s noteworthy that when the same code is utilized in a standalone Android application, it functions without any data loss. Yet, once compiled into an Android library and integrated into Unity, data loss becomes evident.

Further observations reveal:

  1. If I initiate the Unity application using the Android BLE library before utilizing my standalone Android application for BLE communication, data loss occurs on the Android application side as well.
  2. Conversely, if I first run the standalone Android application followed by the Unity application employing my BLE library, there is no observed data loss on the Unity side.
  3. However, subsequent runs of the Unity application result in data loss.

Data Rate on which i am working : 4269 bytes/sec

These observations suggest a potential issue with internal Unity processes not adequately prioritizing BLE communication, or it could relate to the Android OS not prioritizing BLE connections from Unity.

What steps should I take to address this issue effectively?"