Android Question HttpUtils2Service Startup

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
I have been following the post over at https://www.b4x.com/android/forum/t...-activity-submitjob.149664/page-2#post-949499 since I've been having the same issue with a customer using a Walmart Onn tablet with "Android Go.".

The first thing the app does is check for program updates then validates device credentials via a web backend. I can reproduce the HTTP hang consistently if I restart the tablet and then immediately launch the app. I added a variation of the code @OliverA posted as follows:
Initialize HTTP:
    ' Wait to be sure HTTP service is up and running
    ' https://www.b4x.com/android/forum/threads/sending-message-to-waiting-queue-of-uninitialized-activity-submitjob.149674/post-949001
    StartReceiver(HttpUtils2Service)
    Dim piCount As Int = 0
    Do While HttpUtils2Service.TempFolder = ""
        piCount = piCount + 1
        lblInfo.Text = "Waiting for local WiFi connection (x" & piCount & ")..."
        Sleep(4000)
    Loop
This waits for up to 80 seconds sometimes upon startup. Once the app has been ran once you never see it displayed.

What caused the issue for me was the HTTP job never timed out and it never produced a response either (thereby hanging the app). I initially got around this by adding my own internal timeouts to handle things. By adding the above code you can see a delay waiting for the service, then once that loop completes the app behaves as normal.

My question is: should this be the new design model or is there something that can be done with the HttpUtils2Service to mitigate this issue?
 
Last edited:

jahswant

Well-Known Member
Licensed User
Longtime User
The solution is here

 
Upvote 0
Solution
Top