Android Question Bluetooth mnuDisconnect

saunwin

Active Member
Licensed User
Longtime User
Good evening,

I'm having bluetooth problems (story of my life at present).
If I fire up my app from boot up, I can connect to my HC-06.
If I then exit my app and re-start it I cannot connect to the HC-06
I have a mnuDisconnect and a mnuExit. Is there something these routines should do, to correctly disconnect the bluetooth module, so I can reconnect again ?
TIA

B4X:
Sub mnuEXIT_Click
    Activity.Finish
End Sub
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

saunwin

Active Member
Licensed User
Longtime User
Thanks Erel,
Compiling the code above, does a similar thing.
The device is found - Log($"Device found: ${Name}"$)
The tablet status reports "trying to connect..." and that's it, it never connects.

I unpaired the HC-06 and re-paired, Power off/on (both devices), 3v3 is stable to the HC-06 (decoupling capacitor, etc.) but I cannot get any further.
Ideas ?

Erel - You are of course correct. My code is stuffing up BT comms somehow, preventing other apps from working also.
 
Last edited:
Upvote 0

saunwin

Active Member
Licensed User
Longtime User
OK - If I download some of the examples in the forum - I can get them to work. I've rewitten the bluetooth discovery stuff (as per the tutorial above) - After I've run my app, bluetooth is completely knackered. nothing will work (even forum examples) I get java.io.IOException: read failed, socket might closed or timeout, read ret: -1. Which means my app is breaking something, which brings me back to my original question. when leaving my app is there something that should happen to "release" or reset the hc-06 ? TIA


Is there a clue here ?


SLR games BuzzWire 3:983:32:20:92:4E
connected: true
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
sending message to waiting queue (astreams_error)
** Activity (main) Create, isFirst = false **
running waiting messages (1)
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
SLR games BuzzWire 3:983:32:20:92:4E
connected: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…