maybe I understood where the problem is …
when there is no connection, Web_API call Get, does not block “then do”
why?
maybe I understood where the problem is …
when there is no connection, Web_API call Get, does not block “then do”
why?
You want to say that if there is no connection, the blocks inside the “then do” are not called at all and therefore the old value “connected” preserved?
But then it looks very strange. Blocks work on my three devices, but not on yours - this is not good.
Hi, i agree with this point, it’s impossible to catch error when internet connection is lost !
Cache-control header doesn’t change any thing;
error field is never feeded. (Android 8.1)
Timestamp is not a good solution.
Thanks.
I just call a website and if there is a response I assume internet connection is on. No numbers or anything
Sorry to insist, but can someone tests the following sequence :
1 - In a standard call to web API let’s define an URL never used before. (http://worldclockapi.com/api/json/utc/now/ for example)
2 - Refresh the app on the live test Android device, but DONT access this URL.
3 - Stop WIFI and GSM/3G/4G on the device.
4 - Try to access the URL.
5 - The error is trapped in the error variable : Network request failed – good !
6 - Now let’s connect the device to the network.
7 - try again to access the URL, it works – good !
8 - Now disconnect again the device from network.
9 - try again to access the URL, it works and you get the result of the last access — not so good !
It seems that a cache somewhere prevents from detecting network failure.
Unfortunately, on a real device I can’t check it. Try to change the algorithm like this:
Does it work for you?
If we are talking about a cache, then you can change the url before calling WebApi.Get. For example, first set the first url, and the next tick - the second, then the first again, and so on. I noticed that the WebViewer component caches requests and perhaps a similar situation happens with WebAPI.
Thank’s for these ideas.
The following block switches from one url to another at each click :
It works fine when the network is OK.
When the network is stopped on the device … it’s the same, always exiting with the “Connected to…” message, switching from one url to the other.
NEVER “noWeb” exit.
One important point : i tried to erase “Thunkable” Android app data (cache is not sufficient), and IT WORKS !
First click goes directly to “noWeb” exit, second too, and so on…
But when network come back one time it’s finish.
It seems that outputs of the web API call (response , status, errror) are stored in the Android app, not initialized at app lauch or before each call, and re-used if web API fails.
Regards.
Thank you for your detailed study of the problem. I will try to find an Android device to check this moment.
There is another way, but it is difficult - to use FireBase. Approximate algorithm. Variable = 0. We read the timer from FireBase for this variable, for example, 1 and in the application we increase its value by 1 and write it back to FireBase. If, after 10 ticks, the old value is equal to the new one, then, obviously, it was not updated via FireBase and the connection is lost.
Did anyone have solution fo that problem?
Hi there,
The easiest way is…