I have a strong Android background but I have recently developed a PWA that can be installed to a users device. I have noticed that when the app starts for the first time, the splash screen shows and then the app displays it's first page which is great. Now, if the app has been backgrounded for a while and I relaunch the app, it sometimes appears to display a white screen for a few seconds then the app kind of flickers and some aspects of the page reload, creating a jarring experience.
I am familiar with how lifecycles work in Android, saveInstanceState and all that jazz, but what is actually happening here with a PWA is backgrounded? I am unable to debug what is happening because it takes a long time to reproduce and the debugger needs to be attached before launching the app.
Are there any documents describing exactly what is happening with the lifecycle of an installed PWA and how to gracefully restore it when it has been backgrounded or background-killed?
You may look into this documentation. "Progressive Web Apps have to be fast, and installable, which means that they work online, offline, and on intermittent, slow connections. To achieve this, we need to cache our app shell using service worker, so that it's always available quickly and reliably." A service worker has a lifecycle that is completely separate from your web page. Based from this article, a service worker lifecycle usually has three stages:
You may read the article for more information. Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With