Android Question Bluetooth discovery

avadhut prabhudesai

Member
Licensed User
Longtime User
hi,m a newb to b4a..m trying to get data from pic18f4550 thru bluetooth to my android app..but m stuck on very first step..my app shows list of all paired devices but fails to connect with any of them...it gives exceptions as.."service discovery failed"...can somebody help?? m using same code as given by erel in tutorial pdf..using "serial" type and not BluetoothAdmin..
 
hi erel,
first m getting all paired devices list in a Map from getPairedDevices and then asking user to choose one. then m giving that mac id to serial.connect
this is my code fragment..
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)) 'add the friendly name to the List
Next
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
End If
 
Upvote 0
This means that the bluetooth device is not listening for incoming connections. At least not on the address that you are trying to connect to (which is 00001101-0000-1000-8000-00805F9B34FB if you are calling Serial.Connect)...
Could u plz elaborate this ans?? I dnt understand which address u r referring to...
 
Upvote 0
I hve changed my device from hc05 to hc 06...now i can discover it...but wen i try to cnnect using serial.connect it gives error..
Javaioexception:connection failed or aborted
Wat could b done for it??
 
Upvote 0
make sure your HC module is in slave mode.. otherwise you should change it by AT commands
 
Upvote 0
Back
Top