Android Question Bluetooth reconnection problem

BorisK

Member
Licensed User
Longtime User
Hello,

I wrote the application using Bluetooth connection like it is described in tutorial:
http://www.b4x.com/android/forum/threads/android-serial-tutorial.6908/

I communicate with my own external hardware which is using BT module. It works excellent.
But when I disconnect the connection in my application and then connect again the connection seems to be OK (I get toastmessage, control LED turns on) but the datastream is not established. Exiting from application doesn't help. I can fix this by:
1) turn my Samsung device off and on (just disabling and re-enabling Bluetooth is not enough)
2) go to Task manager and clear RAM; This helps!

How could I save this problem inside my B4A application?

Thank you very much!
 

BorisK

Member
Licensed User
Longtime User
That is what I do to close the connection (and nothing else):

B4X:
Serial1.Disconnect
connected = False

After this the control LED on my external hardware turns off.
 
Last edited:
Upvote 0

BorisK

Member
Licensed User
Longtime User
Yes, that was an issue! Thank you.

Another question: Is the order of the following sentences important?

B4X:
AStream.Close   
connected = False
Serial1.Disconnect
 
Upvote 0
Top