Android Question sending message to waiting queue of uninitialized activity (submitjob)

vecino

Well-Known Member
Licensed User
Longtime User
Hello, I have searched the forums and I have seen several messages with the same error, although in no case I have found what the solution is, or why the error occurs.
The problem is that it occurs on some devices, however on others it works fine.
Any idea what I should change to make it work on all devices?
Thanks.

B4X:
Wait For(WSCallSoapURL(WSLinkSoap, cParams.ToString)) Complete (Result As String)


Public Sub WSCallSoapURL(URL As String, Parameters As String) As ResumableSub
    Dim Result As String
    Dim j As HttpJob
    Try
        j.Initialize("", Me)
        j.PostString (URL, Parameters)
        j.GetRequest.SetHeader("Content-Type","text/xml")
        j.GetRequest.SetHeader("Content-length", Parameters.Length)              
        Wait For (j) JobDone(j As HttpJob)      ' <-- Here is the error.
        If j.Success Then
            Result = j.GetString
        Else
            ToastMessageShow("¡Hummm...!",False)
        End If
    Catch
        Log(LastException)
    End Try
    j.Release
    Return Result
End Sub
 

OliverA

Expert
Licensed User
Longtime User
If it was a B4A problem then it would take the same on all devices.
How is Xfood installing/testing your app? How are you testing your app? In your app, does this happen all the time? The first time you install and run it? Every time you run it (by itself, without B4A debugging, etc.)? After reboot?
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Through private messages we have shared the test applications.
On Xfood devices they always work well.
Both in debug and release mode.
On my device, the same tests, with the same applications, in debug, in release: Some odd time it works fine (I mean HttpUtils2Service starts fast), but that happens once out of a hundred attempts.
Normally HttpUtils2Service takes 30 to 60 seconds to start (70% of the attempts), and the rest of the tests take several minutes, up to 5 minutes. Sometimes HttpUtils2Service never starts at all.

In my case I have even performed a factory reset at least a dozen times.
The tests have been done after a reset. After a power off/on. After waiting a while (at least one hour.). After several hours have passed.

I've been desperate for more than a week with this problem, I just had to throw the device out the window, but I've held back because I hope to find a solution.

I have also tested applications in "Activity" mode and "B4XPages" applications.
I think everything has been tried.

And on all XFood devices it always works fine.
On my device, in 99% of the attempts, it works always wrong.

So I think it's not a B4A problem, even not Android problem either, rather I think it must be some hardware or firmware problem, I don't know, I wish I knew.
 
Last edited:
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
I have corrected a few errors in the translator I am using, my English is very basic.
 
Upvote 0

Xfood

Expert
Licensed User
the device on which I test is slightly different, same brand, I attach the characteristics, I installed in release mode, and it worked immediately, it gives me the connection and returns the expected value, even if I press the button several times, it connects and the data always arrives, I also tried to leave everything on and press the button even after hours, the connection has always worked, I restarted the device, and launched the device application, and it continues to work without any problems
 

Attachments

  • 1692960867799.png
    1692960867799.png
    106.1 KB · Views: 138
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Upvote 0

OliverA

Expert
Licensed User
Longtime User
I'll get back to the office in 1 hour and I'll let you know
Actually, it looks like that is a separate issue. Could I get a copy of your project that is having the issue?
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Well, I have tried the application you linked.
The first time I ran it and after waiting a little over 10 minutes seeing "TempFolder=", I got bored and closed it.

I ran it again and this time at counter 142 it finally started "httputils2service".
The rest of the "activity" worked fine because "httputils2service" was already active.

TempFolder=
TempFolder=
TempFolder=
*** Receiver (httputils2service) Receive (first time) ***
TempFolder=/data/user/0/http.problem/cache
WhileCount=142
JobName = GetProfile, Success = true
{"id":1,"title":"iPhone 9","description":"An apple mobile which is nothing like apple","price":549,"discountPercentage":12.96,"rating":4.69,"stock":94,"brand":"Apple","category":"smartphones","thumbnail":"https://i.dummyjson.com/data/products/1/thumbnail.jpg","images":["https://i.dummyjson.com/data/products/1/1.jpg","https://i.dummyjson.com/data/products/1/2.jpg","https://i.dummyjson.com/data/products/1/3.jpg","https://i.dummyjson.com/data/products/1/4.jpg","https://i.dummyjson.com/data/products/1/thumbnail.jpg"]}
title=iPhone 9
 
Upvote 0

Xfood

Expert
Licensed User
Can you try this application? https://www.b4x.com/android/forum/t...ialized-activity-submitjob.149674/post-949328
Install and use Activity4 first? How fast after picking an account does it ask the yes/no question?
the yes/no message never pops up
the log is generated right away, maybe the device needs to go out to the internet?

Log:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity4) Create (first time) **
** Activity (activity4) Resume **
** Activity (activity4) Pause, UserClosed = false **
sending message to waiting queue (OnActivityResult)
running waiting messages (1)
TempFolder=
** Activity (activity4) Resume **
*** Receiver (httputils2service) Receive (first time) ***
TempFolder=/data/user/0/http.problem/cache
WhileCount=1
ResponseError. Reason: java.net.UnknownHostException: Unable to resolve host "dummyjson.com": No address associated with hostname, Response:
JobName = GetProfile, Success = false
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
What versions of Android are you dealing with? For example, the issue appears for me on a Pixel 7 with Android 13.
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
I believe that the problem has been clarified.
What is not clear is the reason why it occurs.
On some devices "HttpUtils2Service" starts instantly.
On other devices "HttpUtils2Service" takes some time, or takes a long time to start.
Why does this happen?
What can be the solution?
I think we need knowledgeable experts to confirm if it is hardware problem, firmware problem, software problem....
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Maybe Erel has some idea how to speed up the execution of "HttpUtils2Service", or can give some idea where the problem comes from and how it can be solved.
 
Upvote 0
Top