Restart the Application with a button or method?

I was wondering if there is a quick way to restart the application. For mine once the user has completed, they need to start at the beginning again, and I want all variables reset, etc. Is there an easy way to do this from within the app?

I have nearly 1000 blocks, and I dont want o create a “refresh function” if I dont have to.

Thanks in advance.

Make a procedure where you (re)set all variables. Call that when it is necessary.

1 Like

Peter,

I know that process, but as I mentioned I have over 1000 blocks, that is going to take a long time, because there is no way to select all variables, I would have to create an 80 or 100 block procedure. Is there any other way?

Don’t you have to set those variables in the beginning of your app? Are there variables that have the same value?

I do, but as blocks. They are all grouped together and organised. There are a number of other view’s, visible, colours, and status bars that have to be reset as well.

If you put all those variables/blocks together in a procedure then you are allright. I know you have to reorganize but i guess it could be worth it.

So to be clear, there is no functional way to do it without having to manually add all relevant blocks to a new function.

Don’t worry about that good suvilian :sunglasses: I’ve listened to your request :wink:

Thanks Nathan :slight_smile: I will be eager to help or test :slight_smile:

1 Like

I am jumping from nowhere in this topic, but have a look at this :point_down: snippet shared by @Mika

https://community.thunkable.com/t/restart-the-app/1590/2

Hope it helps :+1: :slight_smile:

1 Like

That restarts the screen, not the application.

While I know variables are not passed from one screen to another, I am not sure about the other things like labels/text visible etc.

Too many blocks for me to debug on my big app, however I will give it a go.

Nice contribution @Vaibhav

I wanted to follow up with what I did to address this.

Because variables are not stateful across screens, when you close a screen you lose everything there, (unless you store it in a persistent system like TinyDB etc)

What I needed was a way to restart the process of my app, without all the welcome crap. But I needed it to be a clean start.

Here is what I did:

Screen1

I setup a custom notification process so that if the New User button is clicked, it gets here. I have two things going on here.

First : I have Firebase Stats on the system so I can track the number of times individually and globbaly this process is called.

Second: I pass a value to the new Screen.

Now on NewUser screen, this is how I set it up.

  1. I set a slight delay to make sure that all the code is loaded for that screen.
  2. I turn the timer off. This is critical, otherwise it will loop for a while trying to figure out what to do.
  3. Now I assess the startValue. If it is 1, then I know where it came from. If not, well for now I close the app.
  4. If it is 1, I can close the screen, and go back to loadup screen 1, and I do so with a new starting value. This allows me to change my startup routine.

Now I can assess if the Screen had a start value, and slightly change my startup process so the user does not think the app restarted.

I Found A Good Way Actually i Was Searching For This My App
And Seen This But Not Got
But Found my own!
Just Make an empty screen
and in that set when that screen intialize open screen 1
and where you want to restart just set that screen
you are done

which means, you opened screen1 twice
see also tip1 here why this is not a good idea…


Taifun

2 Likes

Thanks
But I am not using that much sreen in my apps so it is fine
In total 3 with restart screen

after restarting your screen a few times you might want to test what happens, if you use the close application block to close your app…
Taifun

Maybe open the same screen again by closing the current screen?? :joy:

How can i open recent Screen @Vaibhav . i dnt want to open specific Sceen like using ScreenName. i just want to open recent ( From where user comes to that screen ). How to do that ?

Simply close current screen and you will be on last opened screen.
This will not work if you have switched screens correctly.

1 Like

You are simply superb dev. Thank you so much for the solution @vknow360 .

1 Like