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
 

vecino

Well-Known Member
Licensed User
Longtime User
Oh, that's great, thank you very much.
As soon as you want I'll pass you the program and the little program that goes on the server, so you can try it on one of your devices.
Let me know, please.

Yes, I've restarted it several times and I've been looking in settings, developer options, something that can fix it, but I haven't seen anything.

I've been testing for a while this morning and the same thing happens, it works in debug mode only.
 
Upvote 0

Xfood

Expert
Licensed User
Oh, that's great, thank you very much.
As soon as you want I'll pass you the program and the little program that goes on the server, so you can try it on one of your devices.
Let me know, please.

Yes, I've restarted it several times and I've been looking in settings, developer options, something that can fix it, but I haven't seen anything.

I've been testing for a while this morning and the same thing happens, it works in debug mode only.
as soon as they arrive and I can try on the device I'll let you know..


one thing is not clear to me, has the factory reset been done?
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
as soon as they arrive and I can try on the device I'll let you know..
one thing is not clear to me, has the factory reset been done?
I haven't done it because it's new, I unpacked it myself, plugged it into my computer and nothing else.
Do you think it is necessary?
 
Upvote 0

Xfood

Expert
Licensed User
I haven't done it because it's new, I unpacked it myself, plugged it into my computer and nothing else.
Do you think it is necessary?
yes, sometimes I had to do it on some devices, because they gave me problems, and now when they arrive the first thing I do is a factory reset, and then I configure them according to my needs
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Hi, I have reinstalled from factory and now it is more agile, before it seemed that it was always saturated and did not respond well, it was slow.
However, the error continues:
sending message to waiting queue of uninitialized activity (submitjob)
 
Upvote 0

Xfood

Expert
Licensed User
Hi, I have reinstalled from factory and now it is more agile, before it seemed that it was always saturated and did not respond well, it was slow.
However, the error continues:
ok now we need to intercept the problem, have you configured the scanner in keyboard emulation?
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
I have created a simple B4Xpages project and now it works!!!!
I can't believe it, I don't understand it.
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Yes, I will transfer the Activity project to B4Xpages.
I hope it continues to work well.
Thank you very much, friends.
:)
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
It definitely does not work if the application is of type "Activity".
If it is a "B4XPages" application it sometimes works.
Although it is enough to add a simple "EditText" and it stops working too.
I have created basic test applications, a simple button, nothing more. And the problem continues.

Is there no more information about the reasons why this error message is displayed?

I must say it works fine on any smart phone and any tablet. Where it doesn't work is on this device.
Why can this happen, any ideas?
Thank you very much.
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
You can see that the test applications I have created are nothing special:
 

Attachments

  • test-act.zip
    9.1 KB · Views: 64
  • test-b4x.zip
    9.7 KB · Views: 55
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
I think I know where the problem is coming from, but I don't know how to solve it because I don't know anything about it.
I'm going to do some tests first to make sure that the problem is really coming from where I think it is.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
It may be a similar issue that both @Robert Valentino and @fishwolf encountered:
1) @Robert Valentino - https://www.b4x.com/android/forum/t...-activity-submitjob-with-test-program.149624/
2) @fishwolf - https://www.b4x.com/android/forum/t...e-of-uninitialized-activity-submitjob.149674/

In both cases, @Erel's suggestion of placing
B4X:
'https://www.b4x.com/android/forum/threads/sending-message-to-waiting-queue-of-uninitialized-activity-submitjob.149674/post-949001
StartReceiver(HttpUtils2Service)
Do While HttpUtils2Service.TempFolder = ""
    Sleep(100)
Loop
before the first call of any methods used w/HttpJob seems to solve the issue.

Please note that with the two posts 1) and 2) mentioned here the issue only seems to crop up when
a) The app is installed for the first time on the phone
b) The app is launched the first time after the phone booted

Test program (provided by @fishwolf) that implements this solution can be found here:
1) https://www.b4x.com/android/forum/t...ialized-activity-submitjob.149674/post-949328
(Look at Activity 4)
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Thank you very much, it seems that this is the problem, HttpUtils2Service takes a long time to run (between 30 and 60 seconds).
Sometimes it doesn't even run at all.
It must be a bug of this device.
I will try to get it replaced.
Thank you.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
And this is supposed to be a device hardware problem?
No, it's some sort of Android/B4A issue with starting a receiver. I don't know if this is something that can be solved (besides this solution) on the B4A side or if this is just how Android does its thing. In your case (and the other two), it would be nice if this were fixable on B4A's end.
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
I have been testing thanks to the user Xfood who has the same devices, and in his case the program works perfectly, however in my device it takes a minute, and up to 4 minutes to start HttpUtils2Service.

If it was a B4A problem then it would take the same on all devices.

Don't you think?
 
Upvote 0
Top