Android Question 4G Communication Issue Troubleshooting

tt90

New Member
Hi everyone,

We have a long-standing B4A app that has recently encountered an issue with data transmission on certain devices, which has proven difficult to troubleshoot.

I know it could be anything from server, device, network etc; but I’m seeking general advice on what the cause might be, as well as someone who can review the code and provide any advise.

We’ve updated both B4A and the SDK, suspecting that the issue could stem from OkHttpUtils or the latest version of Android. While these updates have improved the situation, some users are still experiencing problems. Interestingly, those users report that when they tether their tablet to their phone, they can transmit data via WiFi, which suggests a potential cellular issue. However, they are able to browse the internet on their devices without any trouble on 4G.

Thank you

Please find the code snippets below:

GetPhotos:
Sub GetPhotos As StringBuilder
Dim dbList As List:dbList.Initialize:dbList=DBUtils.ExecuteMemoryTable2(Memory.dbdb,"SELECT rowid,JobNumber,EmpSubCode,PhotoID,PhotoDateTime,PhotoType,PhotoDescription,Synced FROM PHOTOS WHERE PhotoID='New' AND (Synced<>'Y' OR Synced IS NULL)",Null,0)
Dim PostData As StringBuilder:PostData.Initialize
If dbList.Size<>0 Then
    For RecNo = 0 To 0
        Dim Record As Map:Record.Initialize:Record=dbList.Get(RecNo)
        Dim RecordText As StringBuilder:RecordText.Initialize
        RecordText.Append("PHOTOS"&Chr(352)&Record.Get("rowid")&Chr(352)) 'RECORD TYPE AND ID
        RecordText.Append(Record.Get("JobNumber")&Chr(352)) ' JOB NUMBER
        RecordText.Append(Record.Get("EmpSubCode")&Chr(352)) ' empsub
        RecordText.Append(Record.Get("PhotoDateTime")&Chr(352)) ' Date/Time
        RecordText.Append(Record.Get("PhotoType")&Chr(352)) ' Type
        RecordText.Append(Record.Get("PhotoDescription")&Chr(352)) ' Description
                
        RecordText.Append(Common.EncodeBase64(Common.loadImageFromBlob(Memory.dbdb, "PHOTOS", "PhotoBlob", Record.Get("rowid"))))
        
        PostData.Append(RecordText.ToString.Replace(Chr(10),Chr(26))&Chr(10))
        If RecNo Mod 20 =0 Then DoEvents
        'If RecordText.Length>5*1024*1024 Then RecNo=50
    Next
    Return PostData

3:
' PHOTOS
Case 7
Dim PostData As StringBuilder:PostData.Initialize
PostData=GetPhotos
If PostData.Length<>0 Then
    lblStatus.Text="Uploading Photos...":GetData2("PhotoData",PostData,"PHOTODATA","Uploading Photos")
    SyncUpTo=-1 ' restart sync from the start again to upload and mark as uploaded each photo
Else
    SyncUpTo=SyncUpTo+1
    CallSubDelayed(Me,"SyncData")
End If

DoRequest:
Sub DoRequest(FromSync As Boolean)
Request=""
Server=""
' CONNECT
IsFromSync=FromSync
Dim Job As HttpJob
Job.Initialize("Job",Me)
If Memory.UseServer="E" Then Server=Memory.mSettings.Get("Server")
If Memory.UseServer="I" Then Server=Memory.mSettings.Get("IntServer")
    'Log(Memory.CommsIO.GET("PostData"))
If Memory.CommsIO.GET("PostStringBuilder")=Null Then
    Request=Request&"UserName="&Memory.mSettings.Get("UserName")&CRLF
    Request=Request&"Password="&Memory.mSettings.Get("Password")&CRLF
    Request=Request&"DeviceSerial="&Phone.GetSettings("android_id")&CRLF
    Request=Request&"AppVer="&Application.VersionName&CRLF
    Request=Request&Memory.CommsIO.GET("PostData")
    
    Request="I/O Message "&Request.length&CRLF&Request
    Job.PostString("http://"&Server&":"&Memory.mSettings.Get("Port")&"/",Request)
    Job.GetRequest.Timeout=30000
    
Else
    Dim sb As StringBuilder:sb.Initialize
    sb=Memory.CommsIO.GET("PostStringBuilder")
    sb.Insert(0,"UserName="&Memory.mSettings.Get("UserName")&CRLF&"Password="&Memory.mSettings.Get("Password")&CRLF&"DeviceSerial="&Phone.GetSettings("android_id")&CRLF&"AppVer="&Application.VersionName&CRLF)
    '    Log(sb.ToString())
        Dim length=sb.length As Int
        sb.Insert(0,"I/O Message "&length&CRLF)
            
        Job.PostString("http://"&Server&":"&Memory.mSettings.Get("Port")&"/",sb.ToString())
        sb.Initialize
    
End If

End Sub


End Sub
 
Top