我刚刚创建了第二个PWA应用程序,并注意到,如果将应用程序安装在Android手机(One Plus 5t)上,则从应用程序图标启动时,该应用程序将停留在启动屏幕上。使用浏览器,它可以正常工作,并且以前曾经可以工作,现在只是停留在飞溅上。我安装了最新的Chrome。我已经多次重新安装了该应用程序。仍然停留在飞溅上。我清理了以前的服务人员和缓存。我刚刚切换到Google Workbox,所以也许与它有关?那么为什么我的应用程序无法打开?这是我的清单和服务人员:
importScripts(
'https://storage.googleapis.com/workbox-cdn/releases/3.6.1/workbox-sw.js',
)
self.addEventListener('install', event => {
self.skipWaiting() // Do I need dis?
})
if (workbox) {
// workbox.setConfig({ debug: false })
workbox.routing.registerRoute(
/.*\.css/,
workbox.strategies.staleWhileRevalidate({
cacheName: 'css-cache',
}),
)
workbox.routing.registerRoute(
/.*\.js/,
workbox.strategies.staleWhileRevalidate({
cacheName: 'js-cache',
}),
)
workbox.routing.registerRoute(
/.*\.(?:png|jpg|jpeg|svg|gif)/,
workbox.strategies.cacheFirst({
cacheName: 'image-cache',
plugins: [
new workbox.expiration.Plugin({
maxEntries: 20,
maxAgeSeconds: 7 * 24 * 60 * 60,
}),
],
}),
)
workbox.routing.registerRoute(
/.*\.(?:mp3)/,
workbox.strategies.cacheFirst({
cacheName: 'audio-cache',
plugins: [
new workbox.expiration.Plugin({
maxEntries: 20,
maxAgeSeconds: 7 * 24 * 60 * 60,
}),
],
}),
)
}
{
"name": "MyName",
"short_name": "name",
"theme_color": "#1e5799",
"background_color": "#1e5799",
"display": "standalone",
"orientation": "portrait",
"description": "My desc",
"start_url": "index.html",
"scope": "/",
"icons": [
{
"src": "images/icons/icon-72x72.png",
"sizes": "72x72",
"type": "image/png"
},
{
"src": "images/icons/icon-96x96.png",
"sizes": "96x96",
"type": "image/png"
},
{
"src": "images/icons/icon-128x128.png",
"sizes": "128x128",
"type": "image/png"
},
{
"src": "images/icons/icon-144x144.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "images/icons/icon-152x152.png",
"sizes": "152x152",
"type": "image/png"
},
{
"src": "images/icons/icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "images/icons/icon-384x384.png",
"sizes": "384x384",
"type": "image/png"
},
{
"src": "images/icons/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"splash_pages": null
}