[置顶] 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:


待续

相关文章
相关标签/搜索