Android Question Transport endpoint is not connected

pin71

Member
Licensed User
Longtime User
Hi All,

I got my bluetooth serial1 connected to another device but sometimes (not always) when I start to send out bytes I get this exception :

"java.io.IOException: Transport endpoint is not connected"

To fix it I have to turn off bluetooth and back on again.

Any ideas?

Thanks
 

pin71

Member
Licensed User
Longtime User
After bluetooth is enabled using "admin.enable" I have a timer which is trying to connect to the device using a given mac address.


B4X:
Sub TimerBT1_Tick

    TimerBT1.Enabled = False
       
    If MachineMac<>"null" Then
        Serial1.Connect (MachineMac)
    End If

    TimerBT1.Enabled = True
   
   
End Sub

To know if it successed I have the usual Sub :

B4X:
Sub Serial1_Connected (Success As Boolean)

    If Success Then
        TimerBT1.Enabled = False       
        ProgressDialogHide
        Allarm.Text = "Connected successfully"
        CONNECTED1 = True
        StartService(BT1)
        Timer1.Enabled = True
        IME1.HideKeyboard
        CallSub("TE","SAV")   
    Else
        CONNECTED1 = False
    End If
End Sub
 
Upvote 0

pin71

Member
Licensed User
Longtime User
I'm not already connected. At the very first connection I have the MAC address saved into a string and then into a file.

When I re-start the application a second time, I get my file loaded and through the address saved into the string I get recconnect automatically without choosing any paired device.
 
Upvote 0
Top