m0dch3n / vue-cli-plugin-cordova

Vue Cli 3 Cordova Plugin
MIT License
417 stars 63 forks source link

implement a service worker? #30

Closed micardona96 closed 6 years ago

micardona96 commented 6 years ago

Excellent complement thanks for sharing, I am working on a web application that uses a service worker to cache the "run time" images in the local storage, and now I create the "mobile application", but when implementing the cordova add-on, the service worker It does not work because the images are always downloading again, it must be by the https, what could I do? Greetings from Colombia, forgive my English.

m0dch3n commented 6 years ago

Why do you need a service worker for an app, where every image etc can be directly be packaged to the app or use the native functionionalities to synchronise in background?

Serviceworkers were made for webapps in the browser, to have the same features like native apps...

So they are not really used for native apps IMO...

So if you need background synchronisation of your "runtime" images, I would suggest to implement this with cordova plugin...

Please also note, for production release, the vue project files are served from the local file system with uri file://android_asset/www/

I think a service worker can not be installed the from the local file system...

m0dch3n commented 6 years ago

My internet search is saying the same:

https://stackoverflow.com/questions/44877656/how-to-use-service-workers-in-cordova-android-app

IOS seems to not support Service workers:

https://hollyschinsky.github.io/todos-app-pwa/lesson6.html

So in short, service workers were made to add functionalities, to browsers and not for native or hybrid apps IMO