Hi all,
I’ve noticed that loading dialog doesn’t get displayed while the app/webpage is in the background. And once it’s brought to the foreground all the loading popovers seem to be presented and dismissed one after another.
In my instance, I have a socket open and if that connection drops, a loading indicator is presented, then dismissed when the connection is reestablished. If the app is in the background and this happens, the popover doesn’t get displayed/dismissed until the user bring the app to the foreground. And if this happens multiple times, the popover flashes at the user as many times as the re connection occurred.
Is this something that other’s have come across? I could figure out a workaround but it’d be a pain and this seems like something that should work better.
Some ionic info…
@ionic/cli-utils : 1.19.1
ionic (Ionic CLI) : 3.19.1
global packages:
cordova (Cordova CLI) : 7.1.0
local packages:
@ionic/app-scripts : 1.3.12
Cordova Platforms : android 6.3.0 browser 5.0.3 ios 4.4.0
Ionic Framework : ionic-angular 3.5.0
Hello?
I can confirm that a loading indicator is not displayed until the app/webpage is brought to the foreground. By appending .then(()=>console.log(…)) to the present/dismiss methods, you can see that these are not executed until focused.
Background mode enabled doesn’t make a difference.
If this bug doesn’t get any attention here sometime soon, I’ll create an issue on github.
Cordova apps are suspended when in the background and resumed in the foreground, so it’s not an issue, it’s how it was designed to work.
I would attempt to handle the events better by subscribing to Platform.pause
and Platform.resume
instead.
Ionic Platform API Docs
Suspended even w/background mode enabled? It still doesn’t seem right that the ionic api can’t update the ui while in the background. It seems worse that it then applies all these updates in succession.
If you’re talking about this plugin then yes, even with background mode enabled:
The system keeps all network connections open while in background, but does not deliver the data until the app resumes.
Every app you use on your phone does this, it just depends on the app to handle what’s changed on resume and how the view looks when doing that.