Current behavior
After add configuration to app module environment.production ? ServiceWorkerModule.register('./ngsw-worker.js') : []
and enable serviceWorker
in .angular-cli.json, my application after install on my device (LG G6) through Chrome with property display
in manifest.json set on standalone
or fullscreen
after open on my device, the application always open in browser in new tab.
When I remove service worker config (row in app module), app with only manifest open in standalone or fullscreen mode.
Expected behavior
After install app, application should open in stadalone or fullscreen mode, depends on set value in manifest.json.
Minimal reproduction of the problem with instructions
I have application generated with version 4.3 and updated to 5.1.3, add @angular/service-worker and generate with angular cli build
with --prod
. For serving the application, I use port forwarding in my chrome.
manifest.json
{
"short_name": "FindPark",
"name": "Find Nearby Car Parks",
"start_url": "/search",
"theme_color": "#206886",
"background_color": "#ffffff",
"display": "standalone",
"orientation": "portrait",
"icons": [
{
"src": "/assets/favicon-72x72.png",
"sizes": "72x72",
"type": "image/png"
},
{
"src": "/assets/favicon-96x96.png",
"sizes": "96x96",
"type": "image/png"
},
{
"src": "/assets/favicon-144x144.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "/assets/favicon-256x256.png",
"sizes": "256x256",
"type": "image/png"
},
{
"src": "/assets/favicon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}
ngsw-config.json
{
"index": "/index.html",
"assetGroups": [{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/index.html"
],
"versionedFiles": [
"/*.bundle.css",
"/*.bundle.js",
"/*.chunk.js"
]
}
}, {
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": [
"/assets/**"
]
}
}]
}
What is the motivation / use case for changing the behavior?
I don't know why isn't working with my application because I find example similar to my app https://angularfirebase.com/lessons/hnpwa-angular-5-progressive-web-app-service-worker-tutorial/ and I clone and build and work fine (display as standalone app).
Environment
Angular version: 5.1.3 (also checked with 5.0.0, 5.0.3, 5.1.0)
Browser:
- [x] Chrome (desktop) version 63.0.3239.108
- [x] Chrome (Android) version 63.0.3239.111
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Node version: 6.11.4
- Platform: Linux
Others:
@ngrx 4
rxjs 5.5.6
Android
I guess the
manifest.json
file is missing in the dist folder when you build your app.Probably you're missing the manifest.json in the assets array in
.angular-cli.json
And make sure you added it to your
index.html
: