• Short answer you don't :p

    Slightly longer answer: The classical and standard way of navigating between apps is calling the load()-function, which always clears everything, runs through boot-files starting widgets and whatnot, and then loads the chosen app (the user chosen clock when called without an argument).

    Recently Bangle.load() was introduced (fast loading) which allows to switch apps without clearing everything, saving time and crucially for a background app/widget that's supposed to 'survive' when switching apps, widgets are preserved. But to avoid ram leaks fast loading should generally be avoided for apps other than clocks and launchers, probably making a background app that is supposed to never be terminated (I don't know precisely what you have in mind) not viable.

    But.. You also have E.on('kill', function() {}) that you could use to save state of the app in a file in storage when it's killed. Then it can be used to set up the app/widget once it loads after the next call to load(). This is probably what you want (this solution is also 'power off'-proof). You can look at one example of this in BW Clocks app.js file line #437

About

Avatar for Ganblejs @Ganblejs started