Reputation: 1119
We have successfully completed our PWA with Ionic 2 and now I want to convert the same source to an Andorid Lite version (hybrid app) to publish in the Appstore.
I added the android platform as
cordova platform add android
in my config.xml android platform version is
AndroidManifest.xml min & max sdk version as android:minSdkVersion="16" android:targetSdkVersion=“23”
Ran my app on my android device (Mashmallow version) with
ionic cordova run android --device
With my Android Studio I found the log as
Expected native library version number “60.0.3112.116”, actual native
library version number “60.0.3112.116” /chromium: [INFO:CONSOLE(26)] "service worker error : ", source: file:///android_asset/www/index.html (26)
I am unable to load my app and the index.html is keeps on loading and nothing is visible on the screen. Also from caniuse.com I came to know that service worker supports in android only from chrome version 61.
Can some one help me out!
regards, Mano
Upvotes: 0
Views: 1550
Reputation: 2939
If you just want to be able to be found in play store you can wrap your app with a webview and then load the HTTPS URL of your PWA at startup. That should "solve" the issue.
Upvotes: 0
Reputation: 645
You should not need service worker in hybrid app, as all services provided by service worker could be done on app. Service workers are specific for PWA, and should be removed/hidden if build native/hybrid App. I recommend you to read Using Ionic/Cordova app sources as PWA to understand how to switch form a pwa Ionic implementation to native app, and vice versa.
Upvotes: 0
Reputation: 7517
Service workers are not supported in hybrid apps because your webpage is served via the file://
protocol and service-workers only work using the https://
protocol. See here:
Service workers only run over HTTPS, for security reasons. Having modified network requests wide open to man in the middle attacks would be really bad.
Upvotes: 2