OK, I have a HC-05 module, when I search for the HC-05 using the phones built in bluetooth pairing it see it and I can pair with it, I can also see another nearby mobile phone however when I run my app and search for the HC-05 it fails to see it or the other phone! If I have already paired with the HC-05 I can select it from the paired list in my app and it works fine!
I do not move phone or HC-05 during either test. Any ideas anyone?
B4X:
Sub btnSearchForDevices_Click
Dim PairedDevices As Map
PairedDevices = serial1.GetPairedDevices
Dim l As List
l.Initialize
For i = 0 To PairedDevices.Size - 1
l.Add(PairedDevices.GetKeyAt(i))
Next
If l.Size > 0 Then
Dim res As Int
res = InputList(l, "Choose device", -1) 'show list with paired devices
If res <> DialogResponse.CANCEL Then
serial1.Connect(PairedDevices.Get(l.Get(res))) 'convert the name to mac address and connect
Else
foundDevices.Initialize
If Admin.StartDiscovery = False Then
ToastMessageShow("Error starting discovery process.", True)
Else
ProgressDialogShow("Searching for devices...")
End If
End If
Else
foundDevices.Initialize
If Admin.StartDiscovery = False Then
ToastMessageShow("Error starting discovery process.", True)
Else
ProgressDialogShow("Searching for devices...")
End If
End If
End Sub
Been playing whilst I wait for Gman's reply and I am beginning to think it's the phone (S5), I have another cheap phone and using this phone I test the Bluetooth example from here:-
I'm using serial 1.26. I add the permission access_coarse_location. i'm running b4a 6.5
the discovery process fires the start and finished event, but never the devicefound event
the serial getpaireddevices show all possible devices, but serial.connect dosn't connect to the choosen device.
manually i can choose the device, it's working fine.