Using service workers in a non pwa app


Would it be possible to add the angular/pwa and with that service workers, but still production build it as an ios and android app ?

And will the service workers still work since the app runs in a browser after all.

With best regards,

I guess this will work
But why would u need sw in a ios/android build?

For caching purposes and offline availability

Caching not sure if that is essential on ios/android, but that is a matter of testing (cordova/capacitor build i assume)

Offline storage depends on size needed. Sqlite ionic storage may be better. Also because iOS is fussy with sw and storage

Maybe i’m still mis-understanding what service workers can actually do. We’ve got a lot of user specific info being loaded of a server. Think timelines, photo albums etc. Is a service worker not the right way to make user content available when offline ?

If u r interested deploying as ios/android app through cordova/capacitor then I would say no

Have some sort of load stage with progress UI and save it locally using File plugin etc

Will be some coding but if that is the nature then that I think is the best way

And do mind security: anything stored on the local device is subject to easy hacking. Even if it is encrypted

Alright thanks for the advice.

On the security part i understand anything is hackable but that would mean you could never store any personal data. I suspect facebook does some form of caching on device to limit server loads and user data plan loads etc.

All depends on your usergroup and risk but anything encrypted on the device can be taken from it and attacked.

So personal data can get tricky. Never store passwords and private keys locally. Remove direcrly from memory and replace with session tokens (if online)