我正在构建一个Angular渐进式Web应用程序.我希望我的应用程序行为像本机应用程序,但我遇到一些问题,如果你希望它的行为像本机应用程序那样不应该存在.
我已经将它构建为PWA并且它已成功添加到我的主屏幕上.应用程序和图标都显示在主屏幕上.
但我面临的问题是:
>当我搜索它时,就像我在手机上搜索其他应用程序一样,它不在列表中.但我已经使用Flipkart Lite测试了这个场景,我已将其添加到我的主屏幕中,当我搜索它时,它出现在应用程序列表中.
我的manifest.json是:
{ "name": "beautyOfSoul","gcm_sender_id": "103953800507","short_name": "beautyOfSoul","theme_color": "#1976d2","background_color": "#fafafa","display": "standalone","scope": "/","start_url": "/","icons": [ { "src": "assets/icons/icon-72x72.png","sizes": "72x72","type": "image/png" },{ "src": "assets/icons/icon-96x96.png","sizes": "96x96",{ "src": "assets/icons/icon-128x128.png","sizes": "128x128",{ "src": "assets/icons/icon-144x144.png","sizes": "144x144",{ "src": "assets/icons/icon-152x152.png","sizes": "152x152",{ "src": "assets/icons/icon-192x192.png","sizes": "192x192",{ "src": "assets/icons/icon-384x384.png","sizes": "384x384",{ "src": "assets/icons/icon-512x512.png","sizes": "512x512","type": "image/png" } ] }
我的app.module.ts文件正在导入服务工作者:
environment.production ? ServiceWorkerModule.register('ngsw-worker.js') : [],ServiceWorkerModule.register('/ngsw-worker.js',{ enabled: environment.production })
请让我知道如何才能实现这一目标.
检查您是否已将元标记添加到HTML中.某些移动操作系统需要某些元标记才能使PWA正常工作.
原文链接:https://www.f2er.com/angularjs/141745.html有关PWA Meta的更多信息,请查看此信息. https://github.com/gokulkrishh/awesome-meta-and-manifest
<Meta name="viewport" content="user-scalable=no,width=device-width,initial-scale=1,maximum-scale=1"> <Meta name="mobile-web-app-capable" content="yes"> <Meta name="application-name" content="App name"> <link rel="icon" sizes="192x192" href="./logo.png"> <!-- Add to homescreen for Safari on iOS --> <Meta name="apple-mobile-web-app-capable" content="yes"> <Meta name="apple-mobile-web-app-status-bar-style" content="black"> <Meta name="apple-mobile-web-app-title" content="App Name"> <link rel="apple-touch-icon" href="./logo.png"> <!-- TODO: Tile icon for Win8 (144x144 + tile color) --> <!-- <Meta name="msapplication-TileImage" content="ms-touch-icon-144x144-precomposed.png"> --> <!-- <Meta name="msapplication-TileColor" content="#3372DF"> --> <Meta name="theme-color" content="#9fa2a3">