Android Question Ble connected problem

bagazhou

Member
Licensed User
Longtime User
I use B4A and BLE2 library 1.36 ,connect ble module “HC-02”,but not fire “Manager_Connected” after ble connected
and i use other ble debug app is well ,What's the problem?

btw: i run BLE_Example is same result
link: https://www.b4x.com/android/forum/threads/ble-2-bluetooth-low-energy.59937/#content

B4X:
Sub Manager_DeviceFound (Name As String, Id As String, AdvertisingData As Map, RSSI As Double)
    LogColor("---------------------- Manager_DeviceFound  ----------------------",Colors.Green)
    Log("Found: " & Name & ", " & Id & ", RSSI = " & RSSI )
    ConnectedName = Name

'    BLE - Connect
    If Name<>Null And Name="HC-02" Then
        manager.StopScan
        Sleep(1000)
        manager.Connect2(Id,False)
    End If
   
End Sub

Sub Manager_Connected (Services As List)
    LogColor("---------------------- Manager_Connected  ----------------------",Colors.Green)   
   
    connected = True
    ConnectedServices = Services
    For i=0 To Services.Size-1
        Log("services:" & Services.Get(i))   
    Next

End Sub

Log
B4X:
---------------------- showProgress  ----------------------
Permission:android.permission.ACCESS_COARSE_LOCATION
Result:true
*** Service (servicebt) Create ***
** Service (servicebt) Start **
------------------- Timer1_Tick -------------------
---------------------- Manager_StateChanged  ----------------------
---------------------- Manager_DeviceFound  ----------------------
Found: HC-02, 00:0C:BF:0A:7B:4E, RSSI = -56
Discovering services.
 
Last edited:

bagazhou

Member
Licensed User
Longtime User
Thank you for your reply
but i test it again.
Andoird(other ble debug app): conected ,discover the services write, read is well
IOS(LightBlue app): conected ,discover the services write, read is well
B4I(my test app): conected ,discover the services write, read is well
but only in android , my app is failed to discover the services , I'm not sure what the problem.
 
Upvote 0
Top