Android Question BLE services - Android/iOS difference

Arf

Well-Known Member
Licensed User
Longtime User
When discovering services with BLE, I get different results when connecting to the same ESP32 module between iOS and Android.
My app is a B4X app, trying to make a cross platform version of it.

With iOS, in Manager_Connected, the services consists of only one line:

with Android, it finds three:


With iOS, I use the single found entry as ServiceID, then do a ReadData of that service I, and I can send data using a hardcoded characterstic ID, works fine.

With Android, when i try write data using the same hardcoded characteristic, it crashes with characteristic not found. I am calling the UUID function to convert the hardcoded characterstic.

Any idea what else I can try?
 

Arf

Well-Known Member
Licensed User
Longtime User
I can connect now on Android, I had to modify that UUID function. No idea why.
B4X:
'utility to convert short UUIDs to long format on Android
Private Sub UUID(id As String) As String 'ignore
#if B4A
    'Return "0000" & id.ToLowerCase & "-0000-1000-8000-00805f9b34fb"    'doesn't work like this
    Return id.ToLowerCase                                                'but does like this
#else if B4I
    Return id.ToUpperCase
#End If
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…