Reload the app

Hello everybody,
I would like to restart my application after the user change the setting.
Because I load the settings on the beginning ( on the abstrat state ) I can’t redirect the him on the first/otherwise state.
Thank you for support!

add a loading overlay, that hides all content --> redirect to your initial state and call $window.location.reload();. It is like a full page reload.

Loading layer is to hide some ugly effects until your app is ready again.
The splashscreen plugin can re-display the splashscreen, but this does not work on android - i think.

2 Likes

Yes, I’ve already experimented with the reload function, but didn’t come in mind to redirect first with $state.go, and because on my state there is already the loader it works well.

Moreover inside my factory I have to use window and not $window.

thanks!

I am successfully showing the splashscreen using the plugin on both Android and iOS btw.

strange i tested it still a few weeks ago. What plugin did you use?

Using:

cordova-plugin-splashscreen 2.1.0 "Splashscreen"

Sample code is:

            if ( navigator && navigator.splashscreen ) {
                navigator.splashscreen.show();
                $window.location.reload();
                $timeout( function () {
                    navigator.splashscreen.hide();
                }, 500 );
            } else {
                $window.location.reload();
            }
2 Likes

Put this in your controller.js

$state.go($state.current, $stateParams, {reload: true, inherit: false});

also make sure you set cache to false in app.js

Hi Everyone,

I used the same method but it didn’t work after installing the app into the real device.

Can anyone guide me please how can I reload my page from the device, not from the browser.

this.navCtrl.setRoot(TabsPage).then(() => {
setInterval(
()=>{window.location.reload();},3000
)
});

Because this code only works in Browser not in Device.

Thanks