I'm using this page: https://developers.google.com/web/fundamentals/engage-and-retain/app-install-banners/ to create a web app banner install.
I have the sw.js as service worker in public/admin/ I have registered with success the service worker and i have the manifest.json in public/admin too like this
{
"name": "Web App Install",
"short_name": "Admin",
"icons": [
{
"src": "/admin/mstile-70x70.png",
"sizes": "36x36",
"type": "image/png"
},
{
"src": "/admin/mstile-70x70.png",
"sizes": "48x48",
"type": "image/png"
},
{
"src": "/admin/mstile-70x70.png",
"sizes": "72x72",
"type": "image/png"
},
{
"src": "/admin/mstile-70x70.png",
"sizes": "96x96",
"type": "image/png"
},
{
"src": "/admin/mstile-70x70.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "/admin/mstile-70x70.png",
"sizes": "192x192",
"type": "image/png"
}
],
"start_url": ".",
"display": "standalone",
"related_applications": [{
"platform": "web"
}],
"related_applications": [],
"prefer_related_applications": false
}
in dev tools
the link of service worker is: https://01f1c2fb.ngrok/admin/pt
the link of manifest.json is https://01f1c2fb.ngrok/admin/manifest.json
but i'm getting an error on trying install the web app the error is
"Site cannot be installed: no matching service worker detected. You may need to reload the page, or check that the service worker for the current page also controls the start URL from the manifest"
Can someone help me please.
i add a folder /pt in admin as admin/pt and added the manifest.json. i got some errors of image when i clicked to "add to homescreen" but i fixed it but now clicking on "add to homescreen" he doesnt fire anything... its all alright for now ?
i tried i mobile phone but not installing ... can someone help thanks Carlos Vieira
i already have made some changes and i get "beforeinstallprompt Event fired" in console using
window.addEventListener('beforeinstallprompt', function(e) {
console.log('beforeinstallprompt Event fired');
});
but no app in mobile is installed
Thanks in advance. Carlos Vieira