Android Question wifi connection problems

fifiddu70

Well-Known Member
Licensed User
Longtime User
hello everyone, in my app I use asyncstream to send a receipt with data to a pos printer, I noticed an anomaly in my app, as soon as the device with my app loses the wifi signal and I try to send the receipt this error connection, so everything is ok, while when the wifi signal comes back and I try to send the receipt, I always get the same connection error, it seems that it can't understand the difference between signal absence and presence of wifi signal, someone can tell me how to solve this problem?

this is the sub where the problem is detected.

B4X:
Sub Client_Connected(ConStatus As Boolean)
    If ConStatus = True Then
        ToastMessageShow("Connesso con wifi su IP " & txtipserver.Text & " Porta " &  txtport.Text,True)
        AStreams.InitializePrefix(CltSock.InputStream, False, CltSock.OutputStream, "AStreams")
        If wifi2.isWifiEnabled = True Then
            If switchcomanda = 0 Then
                btntrasmetti_Click
                Else if switchcomanda = 1 Then
                    btntrasmetti3_Click
                    
            End If
            
            Log(" Client_Connected ha trasmesso a btntrasmetti_Click")
        Else
            mp2.Load(File.DirAssets,"alert.wav")
            mp2.Play
            Msgbox("Non sei connesso con WiFi, controlla se sei connesso", " ATTENZIONE !!")
            
            
        End If
    Else
        Msgbox(" Comanda non inviata, " & CRLF & LastException.Message, " ERRORE DI CONNESSIONE ")
    End If

End Sub
 

fifiddu70

Well-Known Member
Licensed User
Longtime User
Thanks for your reply Erel, the connection code didn't post it, do you want it to be posted?
 
Upvote 0
Top