Restore previous application state after clicking in app icon or exit with back button


Hi guys!

I would like to get some light in a topic that I’ve been facing for a while.

I will explain the steps I’m following:

  1. I launch my app

  2. I click on menu button which will “Suspend” my application.

    • I open my background tasks and I select my application: THIS WORKS and components aren’t loaded again
    • I click on my app icon and the application duplicates, triplicates and so on my AppComponent and the components that are loaded along with it like TabsComponent (in the router-outlet is overwritten).
  3. When I’m in the application and I press the back button, the “Exit” event is raised.

    • I open my background tasks, I select my application and the Components are loaded again which produces that the previous state (the route that was previously activated) is now another activity but still exists within the app
    • I click on my app icon and the application duplicates, triplicates … the components again

My question is: It’s possible to save the state of the application somehow in order to not navigate or load previous components that have been already activated?

Thank you in advance!


You may override the back button behavior and suspend the app instead of default exit, but if user clears it from tasks / run any cleaner apps that forcefully quits the application that may be end of story.


Thank you for your answer!

Actually I’m doing it like you have mentioned, I’m overriding the behavior of the back button, but the interesting fact is that when my console is running the NS project and I click the app icon in order to resume my app, a new instance of the components is created, like if the application was started again from scratch. If I kill the process and I perform the same steps, the application works as it should, do you know why this could be?


An active console doesn’t mean your app is not killed yet. Besides may I know how do you declare that it creates a new instance?


I do have my AppComponent which contains a RadSideDrawer and in the main content of it I load my router-outlet in a lazily way. When I exit the app and I click the app icon in the menu with the console up and running and checking for the “console.log” I may have, the App is loaded again (the AppComponent is loaded). I’m using Webpack for further information