How to specify icons in manifest.json?

How to specify icons in manifest.json? Some seem to use an array, and some use a dictionary. For instance:

https://developer.chrome.com/webstore/get_started_simple

"icons": { "128": "icon_128.png" }, 

But in this source, they use it as follows:

https://developers.google.com/web/updates/2014/11/Support-for-installable-web-apps-with-webapp-manifest-in-chrome-38-for-Android?hl=en

  "icons": [ { "src": "launcher-icon-2x.png", "sizes": "96x96", "type": "image/png" }, { "src": "launcher-icon-3x.png", "sizes": "144x144", "type": "image/png" }, { "src": "launcher-icon-4x.png", "sizes": "192x192", "type": "image/png" } ], 

If I try to install my web application as a chrome extension, and I use the latter format, I get this error:

Therefore, I assume that for this you need to use the first format. However, if I try to install my application as a progressive web application in android, a later format seems necessary ...

+6
source share
1 answer

The short answer is you need both. These are two different manifest files that are used for different purposes and live in different places.

In the Chrome Web Store, you'll create a manifest locally on your computer after the tutorial. This manifest and icon image will be added to the zip file and uploaded to the repository.

 "icons": { "128": "icon_128.png" } 

For the web applications you are installing, you must create a manifest file, upload it to your website along with the images, and then update your HTML pages to link to the manifest on your website.

  "icons": [ { "src": "launcher-icon-2x.png", "sizes": "96x96", "type": "image/png" }, { "src": "launcher-icon-3x.png", "sizes": "144x144", "type": "image/png" }, { "src": "launcher-icon-4x.png", "sizes": "192x192", "type": "image/png" } ] 
+9
source

All Articles