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.
Data Rate:: 4269/bytes per second
Further observations reveal:
- 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.
- 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.
- However, subsequent runs of the Unity application result in data loss.
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?