No. Call the code I posted and then check the Services parameter in the Connected event.
Ohhh ok only the last line you posted.
So I did like this:
Sub btnRefresh_Click
Dim gatt As JavaObject = manager.As(JavaObject).GetField("gatt")
gatt.RunMethod("discoverServices", Null)
End Sub
Ouptut console:
-----------------------------------------------------------------------------------------------
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
Found: Revalue ECU, C0:49:EF2:29:1A, RSSI = -42, (MyMap) {-1=[B@8640ee3, 9=[B@5b5b0e0, 10=[B@780bf99, 18=[B@588625e, 0=[B@bbeb63f}
connecting
Discovering services.
Connected
Setting descriptor. Success = true
writing descriptor: true
Setting descriptor. Success = true
writing descriptor: true
<--- here i pressed the refresh button
Connected
Setting descriptor. Success = true
writing descriptor: false
retries: 4
retries: 3
retries: 2
-----------------------------------------------------------------------------------------------
All new services appeared as wanted in _Connected event sub.
I think we are ok with the Proof of Concept, this is what I was thinking to do both in Android and iOS.
Now.. I don't know if someone has an idea on how to do the same thing we just did for Android, but meanwhile i've started a
stackoverflow thread and the only answer I got is the following:
Call
-[CBPeripheral discoverServices:] a second time.
Make sure that your device sends a
Service Changed indication so that the OS knows to re-scan. (iOS doesn't necessarily honor this as tightly as the spec allows, but just follow the spec and it should work correctly.)