BLE - Facing Data Loss in Android Library(.aar) for Bluetooth Low Energy for Unity

pratyaksh

New member
Feb 21, 2024
1
0
1
Visit site
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?
 

B. Diddy

Senior Ambassador
Moderator
Mar 9, 2012
165,612
4,757
113
Visit site
Welcome to Android Central! I moved this to the Developers Lounge for more specific traffic.

We don't get that many hardcore developers on this forum, so you may want to post in the forums at XDA-Developers.com and Android.stackexchange.com
 
  • Like
Reactions: Laura Knotek