android-bluetoothandroid-ble

How to Send an Audio HEX file to Ble Device


I have a working ble device with android . it sends and receives data finely through the Android app. But Now My Problem is I want to send Some Audio HEX files to my BLE Device. And its larger Than 20 bytes. How Can i send such a data to a BLE Device. ??


Solution

  • For send data upper than 20bytes, you need to change the MTU-exchange.

    To API LEVEL 21, you can use requestMtu (Android Developer), it negotiates with the peripherical device and you can define until 512 bytes.

    The MTU value is defined in peripherical side. Remember the data size that you can send is MTU-3 bytes.

    For API LEVEL less than 21, the MTU is pre-defined and you can't modify.