[置頂] Firefox OS 學習——manifest.webapp結構分析

         在Firefox OS 學習——Gaia 編譯分析  這篇文章屢次提到manifest.webapp文件,對於作過android app 開發的人來講,都很熟悉Android.mk 和Manifest.xml文件。在Firefox OS中,manifest.webapp的做用是綜合了android 中的Android.mk 和Manifest.xml的做用。下面就具體說說manifest.webapp的結構及其內容。html

        manifest.webapp採用的是json的數據格式(鍵值對的形式),它描述了app 的name,icon,loacl,premissions等相關的信息。先看一個相對完整的manifest.webapp的格式及其內容:android

 

{
    "name": "MozillaBall",
    "description": "Exciting Open Web development action!",
    "launch_path": "/",
    "version": "1.0",
    "type": "privileged",
    "icons": {
      "16": "/img/icon_16.png",
      "48": "/img/icon_48.png",
      "128": "/img/icon_128.png"
    },
    "developer": {
      "name": "Mozilla",
      "url": "https://mozilla.org/en-US"
    },
    "installs_allowed_from": [
      "https://marketplace.mozilla.org"
      "https://marketplace.example.org"
     ],
    "appcache_path": "/cache.manifest",
    "locales": [
      "es": {
        "description": "¡Acción abierta emocionante del desarrollo del Web!",
        "developer": {
          "url": "https://mozilla.org/es-ES"
        }
      }      
      "it": {
        "description": "Azione aperta emozionante di sviluppo di fotoricettore!",
        "developer": {
          "url": "http://it.mozillalabs.com/"
        }
      }
    ],
    "default_locale": "en",
    "screen_size": {
      "min_width": "600",
      "min_height": "300"
    },
    "required_features": [
      "touch", "geolocation", "webgl"
    ],
    "orientation": "landscape",
    "permissions": {
      "contacts": {
        "description": "Required for autocompletion in the share screen",
        "access": "read"
      }
    },
    "fullscreen": "true",
    "activities": {
      "share": {
        "filters": {
          "type": ["image/png", "image/gif"]
        }
        "href": "/share.html",
        "disposition": "window"
      }
    }
  }

屬性web

 

      上述code清單中的各類屬性,用法,含義,下面作詳細介紹。這些屬性必須包含String,其實它的屬性大體能夠分爲兩類:強制屬性,可選屬性。json

1.強制屬性安全

       name:默認locale下,web app的名稱,顯示在設備中app的名稱,最大支持128字符
app

       description:默認locale下,web app的簡短描述(查詢了一些資料,沒發現它的功能)最大支持1024字符webapp

       default_locale:設置默認的locale,肯定name,description的語言環境。學習

2.可選屬性網站

       launch_path:指定web app被打開時,首先加載的東西,通常都是"/index.html".若是值缺省了(即"/"),將加載域名的東西。webgl

       version:web app的版本號,

       type:肯定這個app 和manifest如何被runtime解析,還有所使用的安全機制。它的值只能是下面三個中一個:

             * web:正常的web app能夠單獨存在,在應用商店能夠下載安裝,而且會列舉有限的權限。type 不指定時,默認是web。

             * privileged:就像android Ios 同樣單獨存在的app,會在本地安裝一個文件包。它須要經過應用商店的審覈。

             * certified:不用於第三發app中,屬於系統級別的東西,例如系統設置,撥號器,電源管理等。相似android:sharedUserId 做用把。

      icons:app icon,支持 16 x 16, 32 x 32, 48 x 48, 64 x 64, 128 x 128 and 256 x 256

      developer:開發者相關的信息,包括開發者名稱,及其URL。

      installs_allowed_from:指定app能夠從那些應用商店安裝,"*"能夠從任何地方安裝," "沒法從任何網站商店安裝。

      appcache_path:


待續

相關文章
相關標籤/搜索