Hi All,
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?
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
Last edited: