# Connection check

**URL:** https://community.thunkable.com/t/connection-check/52482
**Category:** Questions about Thunkable X
**Created:** [October 18, 2018, 10:02am UTC](https://community.thunkable.com/t/connection-check/52482 "2018-10-18T10:02:25Z")
**Posts on this page:** 11
**Page:** 2

<div class="post-metadata">

### Author: ![Antonio\_Vitolo](https://avatars.discourse-cdn.com/v4/letter/a/73ab20/32.png) [@Antonio\_Vitolo](https://community.thunkable.com/u/Antonio_Vitolo)
#### Post date: [October 19, 2018, 1:22pm UTC](https://community.thunkable.com/t/connection-check/52482/21 "2018-10-19T13:22:24Z")

</div>

maybe I understood where the problem is …  
when there is no connection, Web\_API call Get, does not block “then do”

why?

---

<div class="post-metadata">

### Author: ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)
#### Post date: [October 19, 2018, 6:36pm UTC](https://community.thunkable.com/t/connection-check/52482/22 "2018-10-19T18:36:40Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![jmrchy](https://avatars.discourse-cdn.com/v4/letter/j/b487fb/32.png) [@jmrchy](https://community.thunkable.com/u/jmrchy)
#### Post date: [November 10, 2018, 11:13am UTC](https://community.thunkable.com/t/connection-check/52482/23 "2018-11-10T11:13:24Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![AcrobatEpee](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/acrobatepee/32/26336_2.png) [@AcrobatEpee](https://community.thunkable.com/u/AcrobatEpee)
#### Post date: [November 10, 2018, 3:48pm UTC](https://community.thunkable.com/t/connection-check/52482/24 "2018-11-10T15:48:00Z")

</div>

I just call a website and if there is a response I assume internet connection is on. No numbers or anything

---

<div class="post-metadata">

### Author: ![jmrchy](https://avatars.discourse-cdn.com/v4/letter/j/b487fb/32.png) [@jmrchy](https://community.thunkable.com/u/jmrchy)
#### Post date: [November 10, 2018, 9:45pm UTC](https://community.thunkable.com/t/connection-check/52482/25 "2018-11-10T21:45:32Z")

</div>

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/](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.

---

<div class="post-metadata">

### Author: ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)
#### Post date: [November 11, 2018, 8:56am UTC](https://community.thunkable.com/t/connection-check/52482/26 "2018-11-11T08:56:31Z")

</div>

Unfortunately, on a real device I can’t check it. Try to change the algorithm like this:

![%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/5/05626078efa7b8b6fe4af3aaaf99fe7a063974a0.png)

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.

---

<div class="post-metadata">

### Author: ![jmrchy](https://avatars.discourse-cdn.com/v4/letter/j/b487fb/32.png) [@jmrchy](https://community.thunkable.com/u/jmrchy)
#### Post date: [November 11, 2018, 7:13pm UTC](https://community.thunkable.com/t/connection-check/52482/27 "2018-11-11T19:13:13Z")

</div>

Thank’s for these ideas.  
The following block switches from one url to another at each click :

 ![Capture%20du%202018-11-11%2019-43-17](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/6/e6b11748460222ff441bca26cf8a2b2cbf63b6d7.png)

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.

---

<div class="post-metadata">

### Author: ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)
#### Post date: [November 12, 2018, 6:19am UTC](https://community.thunkable.com/t/connection-check/52482/28 "2018-11-12T06:19:57Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![melkaq](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@melkaq](https://community.thunkable.com/u/melkaq)
#### Post date: [July 19, 2019, 11:14am UTC](https://community.thunkable.com/t/connection-check/52482/29 "2019-07-19T11:14:09Z")

</div>

Did anyone have solution fo that problem?

---

<div class="post-metadata">

### Author: ![BlueWhaleYT](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/bluewhaleyt/32/28437_2.png) [@BlueWhaleYT](https://community.thunkable.com/u/BlueWhaleYT)
#### Post date: [July 23, 2019, 5:23am UTC](https://community.thunkable.com/t/connection-check/52482/30 "2019-07-23T05:23:10Z")

</div>

Hi there,  
The easiest way is…  
 ![Screenshot_2019-07-23_132120](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/e/8e98c503c6849b41d8e49508f20cb2f901400e76.jpeg)

---

<div class="post-metadata">

### Author: ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)
#### Post date: [November 8, 2024, 11:52am UTC](https://community.thunkable.com/t/connection-check/52482/31 "2024-11-08T11:52:47Z")

</div>



[Previous page](https://community.thunkable.com/t/connection-check/52482.md?page=1)
