Hi, after a long thread and a lot of testing, we came to the conclusion that when running this:
Depending on the device it may start instantly, or I may start in a few seconds, or it may start in minutes, or it may never start.
This is a problem because in the meantime nothing that uses "http" works.
Only when "HttpUtils2Service" is already started then any http query works fine.
Tests have been done on many devices, and the problem is random, on most of them it works fine. But there are others where it does not start "HttpUtils2Service" right away, as I explained before.
If you try to do, for example, something like "HttpJob.DownLoad" or "HttpJob.j.GetString", etc. you get the message:
It is a very misleading message and apparently has nothing to do with the problem.
Attached is a test project, surely on most devices it will work fine.
The problem is:
How to solve it on devices that take time to start "HttpUtils2Service"?
Here a log of a device:
Here a log from another device:
Thank you very much.
B4X:
StartReceiver(HttpUtils2Service)
This is a problem because in the meantime nothing that uses "http" works.
Only when "HttpUtils2Service" is already started then any http query works fine.
Tests have been done on many devices, and the problem is random, on most of them it works fine. But there are others where it does not start "HttpUtils2Service" right away, as I explained before.
If you try to do, for example, something like "HttpJob.DownLoad" or "HttpJob.j.GetString", etc. you get the message:
sending message to waiting queue of uninitialized activity (submitjob)
It is a very misleading message and apparently has nothing to do with the problem.
Attached is a test project, surely on most devices it will work fine.
The problem is:
How to solve it on devices that take time to start "HttpUtils2Service"?
Here a log of a device:
*** mainpage: B4XPage_Created
TempFolder=
*** mainpage: B4XPage_Appear
** Activity (main) Resume **
*** Receiver (httputils2service) Receive (first time) ***
TempFolder=/data/user/0/b4a.example/cache
0.001 s (Count: 1)
Here a log from another device:
*** mainpage: B4XPage_Created
*** mainpage: B4XPage_Appear
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
TempFolder=
*** Receiver (httputils2service) Receive (first time) ***
TempFolder=/data/user/0/b4a.example/cache
0.965 s (Count: 427)
{"id":1,"title":"iPhone 9","description":"An apple mobile which is nothing like
Thank you very much.