Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify icons in manifest.json?

How to specify the icons in manifest.json? It seems like some use an array and some use a dictionary. For example:

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

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

But in this source, they use it like this:

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 app as a chrome extension, and I use the latter format, I get this error:

So I guess I need to use the first format, for that. However, if I try to install my app as a progressive web app in android, the later format seems required ...

like image 764
Kasper Avatar asked Feb 09 '16 17:02

Kasper


People also ask

What is manifest icon?

One or more icons that represent the extension, app, or theme.

What should be included in manifest JSON?

Using manifest. json , you specify basic metadata about your extension such as the name and version, and can also specify aspects of your extension's functionality (such as background scripts, content scripts, and browser actions).

What is Start_url in manifest JSON?

The start_url member is a string that represents the start URL of the web application — the preferred URL that should be loaded when the user launches the web application (e.g., when the user taps on the web application's icon from a device's application menu or homescreen).

What are the basic attributes to be present in manifest JSON to make the app installable?

The manifest can include basic information such as the app's name, icon, and theme color; advanced preferences, such as desired orientation and app shortcuts; and catalog metadata, such as screenshots. A web app manifest is a required installability criteria in every browser.


1 Answers

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

For the Chrome Web Store you will create a manifest locally on your computer following the getting started tutorial. That manifest and the icon image will get added to a zip file and uploaded to the store.

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

For installable web apps you have to create a manifest file, uploaded 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"
    }
  ]
like image 196
abraham Avatar answered Sep 20 '22 20:09

abraham