How to make ‘try again’ in no connection condition? When ‘try again’ button pressed, it will retry searching for connections
So it will look like this.
How to make ‘try again’ in no connection condition? When ‘try again’ button pressed, it will retry searching for connections
There must be setting in your phone or there is a forever loop (forever loop is a error creator)
Don’t create loops for such reasons as by using them you will most probably end up blocking the rest of your app’s logic. Set a timer that fires every x seconds which will trigger an IF statement using the “device is online?” block.
Could you screen shot your blocks?
I would encourage you to first try following the logic I proposed, instead of just me serving you the solution. You can then share your blocks and we will help you fix any issues with it:
So, for example, you need to know if your device becomes offline while using your app. You can detect this using the “device is online?” block. Since Thunkable won’t check by itself if the device is online or offline, you need to insruct your app to periodically check if it is or if it is not. The best way to do this is with the use of a timer. Check the Thunkable documentation for details about setting one up. Then every time the timer fires, follow this logic: “if the device is online then do nothing else navigate to the screen with the ‘No network connection’ message”. That is all you need to do in relation to the automatic check.
Start with this and send your blocks for us to review.
Hi @Deluxe that was a really helpful reply and just what I was looking for. Once the user is taken to the NO NETWORK screen, how can we close the app when the user presses the TRY AGAIN LATER button or some other component with a similar message? As far as I know, there’s no way you can close the app with Thunkable- the user has to do it manually.
Thanks.
I don’t think @irwin2004’s intention is to close the the app when pressing the try again button. I think that his intention is to check if the device is back online and this can easily be done with an “if” statement. I also think that he has the button there, not knowing that the timer can keep firing every x seconds and automatically navigate between the app’s “main” screen and the “Connection error” screen. There are so many ways to approach this.
Now, I understand you may be asking as you may be looking for ways to close the app. As far as I know, this is not doable but I would then challenge how useful that is when the user can just close the app using a gesture or button like he does with any other app. To be honest, I can’t think of may apps I use which have a “Close app button”, perhaps they do have a “Log out” button but still, they will take you back to the app’s logon screen, not kick you out of the app. I am not saying there aren’t apps which do that but as we are using Thunkable to build our apps, we need to consider the platform’s limitations while designing them.
This is a separate topic actually so feel free to continue it on Discord.
K
Thanks very much for your reply!
Here is my blocks:
This is for the screen
This is for the “try again” button
When I open my app with no internet connection, then I turn on my internet connection, then I click “try again” button. Why it show loading icon? It supposed to show my screen.
This is how it looks:
Notes:
Column is offline display
Data viewer list is online display
Could it be that your Data List Viewer is placed inside the column? Also, can you add another element i.e. an image and hide it as well together with the Data List Viewer to test? It may be that thrmere is an issue with the Data List Viewer.
“No internet connection” is in column73. I make the data viewer list into visible=false and column 73 visible=true.
Can you add another element i.e. an image and hide it as well together with the Data List Viewer to test? It may be that there is an issue with the Data List Viewer.
When I open my app with no internet connection, then I turn on my internet connection, then I click “try again” button. The image is visible but the data viewer still shows loading icon. Is my blocks wrong, so my data viewer only shows loading icon?
Ok so it seems there is a very specific issue with the Data List Viewer whis is not that surprising as it is a relatively new component. Is there any way you can share your project so I can take a look? Thanks.
Here is the link:
https://x.thunkable.com/copy/4c3692d67a938023aa46b569288113a4
It works fine on my Android and iPhone. Have you installed the latest version of the Tunkable Live (Companion) app?
My Thunkable Live version is 258. Have you download it and try the same thing? I download it and its not working.
Can you try this version? It will check if the device is online every 5 seconds so you don’t even need to press the button. Start with your device online and see if the Data List Viewer is visible. Then switch your Internet connection off and you should get the “No internet connection” message. Then re-enable your Internet connection and let me know if you are still getting the same issue with the Data List Viewer:
https://x.thunkable.com/copy/da8bf64d6497f43b7886b887be01fb15
It’s working when I download it. Thank you @Deluxe
What if I want to start with device is offline?