GoogleChromeLabs / bubblewrap

Bubblewrap is a Command Line Interface (CLI) that helps developers to create a Project for an Android application that launches an existing Progressive Web App (PWAs) using a Trusted Web Activity.
Apache License 2.0
2.39k stars 162 forks source link

Fully load the PWA on initial install of the app and keep it that way, so users can rely on offline behavior #597

Open dumbmatter opened 3 years ago

dumbmatter commented 3 years ago

Is your feature request related to a problem? Please describe.

I made an app using Bubblewrap for a video game I wrote. The game works 100% offline. But I just got a one star review saying "whaaat you need internet connection for this cheap trash game". This is an unfortunate situation that (AFAIK) has no good solution currently. What can happen now is:

User installs a TWA from the Play Store, not knowing it is a TWA. User does not open the app until they are somewhere without Internet access. User observes the app does not run without Internet access, even though for the user there is no apparent reason why that should be true.

Similar problem happens if browser data somehow gets cleared... the user cannot really rely on the TWA being accessible offline, there is always a chance it won't be, even if it was previously.

Describe the solution you'd like

Maybe the service worker could be started during installation so it could download all the data it needs to run the app offline? And ideally, as long as the app was installed, this data would not be allowed to be cleared by the browser (I can imagine this point is probably even harder to deal with than the 1st).

Describe alternatives you've considered

Alternative would be the old fashioned way - bundle your entire client side code as an app using Cordova or something. Then it does reliably work offline. But TWA/bubblewrap is so much easier...

andreban commented 3 years ago

Ideally, we would be able to ship resources with the APK to allow the application to start, even if the initial load happens while offline. Unfortunately, this is something that needs support from the browser to be implemented and can't be solved by changing Bubblewrap. There's an issue open in the Chromium bugtracker for this: https://crbug.com/816798. I'd recommend starring the issue and sharing your use-case on the thread.

piotr-cz commented 2 years ago

This doesn't solve the issue, however it should be possible to show at least a You are offline message.

How-to: