Can I re-render the ui when the app launch from background to foreground?


Can Ionic control the event of launching the app from background to foreground?
I want the app back to login page when the app launch from background to foreground
and no redirect animation is show to users. (re-render the ui before the app come to foreground)

Any suggestion?

Thx a lot…

I suffer for this issue for a long time…

Have you tried changing state on resume event?

$ionicPlatform.on('resume', function() {
        $state.go('some state');

I have used this code. I have written some alerts in side the function. But when i switch the app between foreground and background, i am not getting alerts.

$ionicPlatform.on('resume', function () {
   alert("DEBUG: Ionic Resume");

Also i have tried 

document.addEventListener(“resume”, function () {
setTimeout(function () {
alert(“DEBUG: The application is resuming from the background”);
}, 10);
}, false);

But still it not working. If you have an answer could you please share it with me.

Try to use console.log() rather than alert()

I have been trying to achieve the state transition from background, but I can always see the previous state for a moment before it goes to the correct state. Is there some way to unload the current state when in the background? I have tried the transition by using onPause and onResume both separate and together

So, finally, did you solve your issue?
I am now facing same issue.
If you find solution for finding the transition event from background to foreground, let me know.