How to restart app

hey,

i wanted to ask how i can trigger a restart of my ionic 2 app.

1 Like

If you’re asking about an app that you just created and still haven’t made any changes to it, then just delete the app’s folder and then use ionic start with the same parameters that you used to create it the first time.

i like to programmatically do the app restart.

for example with a button.

is that somehow possible?

Sorry, I misunderstood your question, if you want to restart the app itself check out the following article.

4 Likes

that’s exactly what i was looking for.

thx very much for your fast reply

1 Like

this link for android app but how I can do the same for IOS

I would try the following:

  1. Show Splashscreen
  2. setHistory root to your startpage
  3. Call window.location.reload() to reinit all js stuff
  4. Hide splashcreen after an view Event in your appcomponent or somthing like that
8 Likes

If anyone is using lazy loading like me, I faced a problem with window reloading while I am still in the old page. This can be solved by doing the reload inside of setRoot callback.

1 Like

Do you have a code sample of how this might work in Ionic 1?

that’s very different way of code then we use now a days, can provide another code sample.

Thanks a lot @Zahema.

I tried some options to restart my app, but they didn’t work. I think because the use of Lazy Loading that you mentioned. With your solution I can restart the app with Ionic 3 and Lazy Loading. :blush:

Kind regards.
Fernando.

1 Like