I am writing an app with phonegap and jquery mobile.
For handling unknown errors I need to completely restart my app and reinitialise all variables and dynamic content back to being the equivalent of the first run.
Originally I was just using $.mobile.changePage($'#home') which obviously doesn't work because it doesn't reinitialise any of the dynamic content or variables so I end up with double ups.
Is there a method I can call in jquery mobile to completely restart the app and set everything back to the initial settings?
For a full solution, I think you are out of luck.
iOS definitely will *NOT allow the programatic killing of an app, let alone the programatic starting one.
Android does allow the killing of an app. Though undocumented (that I could find) you can use
navigator.app.exitApp();
to kill the current app.
However, you still cant re-start it programaticly.
I think your best bet will be to write the code to reset the variables and local storage/DB (if used). Then reload the index page via document.location.href = 'index.html?var=xxx';
where xxx = the current timestamp. Placing the timestamp at the end will ensure that it pulls a non-cached version of the page.
*Edit: Added not to my statement about Apple allowing app killing as it should have been.