2013年3月23日 星期六

建立Firefox OS的APP專案

基於嘗鮮心理,稍微摸了一下Firefox OS的APP專案製作,初步感覺與Chrome應用程式大同小異,皆以一個manifest檔為核心,且都有區分Hosted AppsPackaged Apps,以下僅列簡易製作步驟:



1. 首先,請閱讀Firefox官方提供的快速手冊,而後便能寫個簡單的manifest.webapp檔,示範如下:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{
    "version": "0.1",
    "name": "地鐵暗棋",
    "description": "A classic chinese dark chess game",
    "launch_path": "/index.html",
    "icons": {
        "16": "/metroDarkChess-16.png",
        "48": "/metroDarkChess-48.png",
        "128": "/metroDarkChess-128.png"
    },
    "developer": {
        "name": "surveyork",
        "url": "http://metrodarkchess.blogspot.tw/"
    },
    "installs_allowed_from": ["*"],
    "locales": {
     "tw": {
            "description": "經典中國暗棋遊戲",
            "developer": {
                "url": "http://metrodarkchess.blogspot.tw/"
            }
        },
        "cn": {
            "description": "经典中国暗棋游戏",
            "developer": {
                "url": "http://metrodarkchess.blogspot.tw/"
            }
        }
    },
    "default_locale": "en",
    "permissions": {
        "systemXHR": {
        "description": "A classic chinese dark chess game"
        }
    }
}

2. 寫好manifest檔後,再將程式所需檔案添加進來:

3. 自行測試沒問題後,再進行模擬器測試,首先開啓Firefox,安裝Firefox OS Simulator此一附加元件:

4. 安裝後,點擊 工具 -> 網頁開發者 -> Firefox OS Simulator


5. 此時會進入到調試界面,點選Add Directory:


6. 選則剛剛編輯好的manifest檔:

7. 開啓後,可看到APP已加入列表,且模擬器自動載入,將模擬器解鎖後按Run

8. 可看到模擬器從開始畫面進入到程式畫面了:

9. 模擬器測試若沒問題,便能打包成zip壓縮檔,準備提交到Firefox Marketplace囉。


沒有留言:

張貼留言