How can I programmatically restart my phonegap app? I exit the app easily through navigator.app.exitApp(), but I would like it to restart immediately.
The reason I
I use the following:
location.reload();
Works a treat for me.
Paul
This works for iOS and Android (at least with 2016 platform versions). It works also in SPA applications.
// keep startup url (in case your app is an SPA with html5 url routing)
var initialHref = window.location.href;
function restartApplication() {
// Show splash screen (useful if your app takes time to load)
navigator.splashscreen.show();
// Reload original app url (ie your index.html file)
window.location = initialHref;
}
Try this
navigator.app.loadUrl("file:///android_asset/www/index.html", {wait:2000, loadingDialog:"Wait,Loading App", loadUrlTimeoutValue: 60000});
Bakri