Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3FA2118F49 for ; Wed, 6 Apr 2016 09:27:22 +0000 (UTC) Received: (qmail 76618 invoked by uid 500); 6 Apr 2016 09:27:19 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 76566 invoked by uid 500); 6 Apr 2016 09:27:19 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 74894 invoked by uid 99); 6 Apr 2016 09:27:18 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Apr 2016 09:27:18 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 22498DFFAE; Wed, 6 Apr 2016 09:27:18 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: dblotsky@apache.org To: commits@cordova.apache.org Date: Wed, 06 Apr 2016 09:27:58 -0000 Message-Id: <96225404e13a4969be2bf1b463228c42@git.apache.org> In-Reply-To: <0ea60741dd3e40f489f34a02f10641c5@git.apache.org> References: <0ea60741dd3e40f489f34a02f10641c5@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [42/51] [partial] docs commit: Adding both Chinese versions. http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/guide/appdev/whitelist/index.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/guide/appdev/whitelist/index.md b/www/docs/zh-cn/3.1.0/guide/appdev/whitelist/index.md new file mode 100644 index 0000000..75a87be --- /dev/null +++ b/www/docs/zh-cn/3.1.0/guide/appdev/whitelist/index.md @@ -0,0 +1,208 @@ +--- +license: > + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +title: 白名單指南 +--- + +# 白名單指南 + +## 概述 + +資源白的就是安全模型控制訪問外部網路資源,如 `http://google.com` 。 Apache 科爾多瓦預設安全性原則允許訪問 Internet 上的任何網站上的任何資源。 在移動之前您在生產中的應用,應審查其白名單和聲明訪問到特定的網路域和子域。 + +## 規格 + +域白為[W3C 構件訪問][1]規範奠定了基礎。 在構件訪問規範中, `` 元素,用來聲明對特定的網路資源的訪問。 Apache 科爾多瓦擴展了此概念允許個別網路資源 (Url) 的白。 在將來,Apache 科爾多瓦將抽象的白平臺實現。 然而,現在每個平臺實現其自己的資源或域的白。 平臺實現之間的差異是在本文檔後面所述。 + + [1]: http://www.w3.org/TR/widgets-access/ + +白名單條目的一般格式如下 Google Chrome 打包企業應用套件的"[模式匹配][2]"規範。 資源指定的 URL,但一個星號 (*) 字元可用作在幾個地方的"萬用字元"表示"任何值可能會在這裡去"。 具體的例子如下所示。 + + [2]: http://developer.chrome.com/apps/match_patterns.html + +## 語法 + +在[google.com][3]的所有資源的存取權限: + + [3]: http://google.com + + http://google.com/* + + +訪問所有資源在安全[google.com][4] ( `https://` ): + + [4]: https://google.com + + HTTPs://google.com/ * + + +對特定的子域[maps.google.com][5]的訪問: + + [5]: http://maps.google.com + + http://maps.google.com/* + + +訪問[google.com][3] (例如, [mail.google.com][6]和[docs.google.com][7]) 的所有子域: + + [6]: http://mail.google.com + [7]: http://docs.google.com + + http://*.google.com/* + + +對上[www.google.com][8] "/ 移動"路徑下的所有資源的訪問: + + [8]: http://www.google.com + + http://www.google.com/mobile/* + + +訪問[google.com][3]上任何協定 (如 HTTP、 HTTPS、 FTP 等): + + *://google.com/* + + +所有資源 (例如, [google.com][3]和[developer.mozilla.org][9]) 在互聯網上訪問: + + [9]: http://developer.mozilla.org + + * + + +## Android 系統 + +### 詳細資訊 + +在找到白規則 `res/xml/config.xml` ,並宣佈與元素``. + +Android 系統完全支援白語法。 + +### 語法 + +[Google.com][3]訪問: + + + + +## 黑莓 10 + +### 詳細資訊 + +在找到白規則 `www/config.xml` ,並宣佈與元素``. + +黑莓 10 比其他平臺兩種方式以不同的方式處理萬用字元: + +1) 由用戶端代碼訪問的內容必須顯式聲明。起源 ="*"將不尊重這一使用情形。或者,可使用首選項禁用所有 web 安全。 + +2) 子域 ="true"可用於代替"*.domain" + +### 語法 + +[Google.com][3]訪問: + + + + +對[maps.google.com][5]的訪問: + + + + +對在[google.com][3]上的所有子域的訪問: + + + + +訪問到所有的域,包括 `file://` 協定: + + + + +禁用所有 web 安全性: + + + + +## iOS + +### 詳細資訊 + +在找到白規則 `AppName/config.xml` ,並宣佈與元素``. + +iOS 完全支援白語法。 + +### 在 3.1.0 中更改: + +之前 3.1.0 版,科爾多瓦 iOS 包括一些非標準擴展域 whilelisting 計畫其他科爾多瓦平臺都支援的。 自 3.1.0、 iOS 白名單現在符合資源白名單語法描述了本文檔的頂部。 如果您從 pre-3.1.0、 升級和使用這些擴展,您可能需要更改您 `config.xml` ,以前一樣繼續白組相同的資源檔。 + +具體而言,這些模式需要更新: + +* " `apache.org` "(無協定): 這將先前匹配 `http` , `https` , `ftp` ,和 `ftps` 的協定。 將更改為" `*://apache.org/*` ",包括所有協定,或都包括您需要支援的每個協定的線。 + +* " `http://apache.*` "(萬用字元域的一端): 這將先前匹配的所有頂級-級別-域,包括所有可能的兩個字母 Tld (但不是有用域喜歡。 co.uk)。 為每個 TLD,您實際上控制,並且需要到白名單中包括一條線。 + +* " `h*t*://ap*he.o*g` "(萬用字元為隨機丟失信件): 不再支援這些 ; 更改包含一條線的每個域和協定,您實際上需要到白名單中。 + +### 語法 + +[Google.com][3]訪問: + + + + +## Windows Phone (7 和 8) + +在找到白規則 `config.xml` ,並宣佈與元素``. + +### 語法 + +[Google.com][3]訪問: + + + + +## Tizen + +### 詳細資訊 + +應用程式根目錄下的 `config.xml` 檔指定域白規則,使用 `` 元素。 完整引用,請參閱[Tizen 訪問外部網路資源檔][10]. + + [10]: https://developer.tizen.org/help/topic/org.tizen.help.gs/Creating%20a%20Project.html?path=0_1_1_4#8814682_CreatingaProject-AccessingExternalNetworkResources + +### 語法 + +[Google.com][3]訪問: + + + + +對安全[google.com][4]的訪問 ( `https://` ): + + + + +對在[google.com][3]上的所有子域的訪問: + + + + +訪問到所有的域,包括 `file://` 協定: + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/guide/cli/index.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/guide/cli/index.md b/www/docs/zh-cn/3.1.0/guide/cli/index.md new file mode 100644 index 0000000..48e3e2c --- /dev/null +++ b/www/docs/zh-cn/3.1.0/guide/cli/index.md @@ -0,0 +1,287 @@ +--- +license: > + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +title: 命令列介面 +--- + +# 命令列介面 + +本指南演示如何創建應用程式並將它們部署到各種本機移動平臺,使用 `cordova` 命令列介面 (CLI)。 此工具允許您創建新專案、 建立他們在不同平臺上,和在模擬器中運行它們。 此外可以使用 CLI 來初始化後,您使用各種平臺 Sdk 來進一步發展他們的專案代碼。 + +## 系統必備元件 + +在運行任何命令列工具之前, 您需要為每個您想要的目標的平臺安裝 Sdk。(參見平臺指南更多詳細資訊。 + +若要添加支援或重建任何平臺的一個專案,您需要從支援的平臺 SDK 的同一台電腦上運行命令列介面。CLI 支援以下組合: + +* iOS (Mac) +* Android (Mac、 Linux) +* 黑莓 10 (Mac、 Linux、 Windows) +* Windows Phone 7 (Windows) +* Windows Phone 8 (Windows) +* Windows 8 (Windows) +* 火狐瀏覽器作業系統 (Mac、 Linux、 Windows) + +在 Mac 上,命令列是可通過*終端*應用的。在 PC 上,它是可作為*命令提示符*下*配件*. + +就越有可能是你在 CLI 運行從不同的機器,更加意義保持遠端原始程式碼儲存庫,你拉下到本地工作目錄的資產。 + +若要安裝 `cordova` 命令列工具,請按照這些步驟操作: + +1. 下載並安裝[Node.js][1]。安裝完成後,您應該能夠調用 `node` 或 `npm` 在命令列上。 + +2. 安裝 `cordova` 實用程式。在 Unix 中,首碼的額外 `sudo` 命令可能需要安裝開發實用程式中以其他方式限制目錄: + + $ sudo npm install -g cordova + + + 安裝日誌可能會產生錯誤的任何已卸載平臺 Sdk。安裝完成後,您應該能夠運行 `cordova` 命令列上。 + + [1]: http://nodejs.org/ + +## 創建應用程式 + +轉至目錄位置您維護您的原始程式碼,並運行以下命令: + + $ cordova create hello com.example.hello HelloWorld + + +它可能需要一些時間完成的命令,有耐心。運行 `cordova -d` ,請參閱有關進展的資訊。 + +第一個參數指定要為您的專案生成的*你好*目錄。 其 `www` 子目錄的房子您應用程式的主頁上,與各種資源下 `css` , `js` ,和 `img` ,其中遵循共同 web 發展的檔命名約定。 `config.xml`檔包含生成和分發應用程式所需的重要的中繼資料。 + +其他的兩個參數都是可選的: `com.example.hello` 參數提供您的專案具有反向域樣式識別碼和 `HelloWorld` 提供了應用程式的顯示文本。 您可以編輯這兩以後這些值在 `config.xml` 檔。 + +## 添加平臺 + +後面的所有命令都需要在專案的目錄或在其範圍內的任何子目錄內運行: + + $ cd hello + + +您可以生成專案之前,您需要指定一組的目標平臺。 您運行這些命令的能力取決於您的電腦是否支援每個 SDK,是否你已經安裝每個 SDK。 運行任何這些從 Mac: + + $ cordova platform add ios + $ cordova platform add android + $ cordova platform add blackberry10 + $ cordova platform add firefoxos + + +運行的這些 Windows 機器上,從任何地方*wp*指的是不同版本的 Windows Phone 作業系統: + + $ cordova platform add wp7 + $ cordova platform add wp8 + $ cordova platform add windows8 + $ cordova platform add android + $ cordova platform add blackberry10 + $ cordova platform add firefoxos + + +運行此檢查當前設置的平臺: + + $ cordova platforms ls + + +(請注意 `platform` 和 `platforms` 命令是同義語.) + +請運行下列同義命令來刪除一個平臺之一: + + $ cordova platform remove blackberry10 + $ cordova platform rm android + + +運行命令來添加或刪除平臺影響專案的*平臺*目錄的內容每個指定的平臺作為一個子目錄中的顯示位置。 *Www*原始目錄轉載內每個平臺的子目錄中,例如出現在 `platforms/ios/www` 或 `platforms/android/assets/www` 。 預設情況下,每個平台佈建檔設置,以便能夠訪問所有的科爾多瓦的 Api。 + +如果您願意,您可以使用 SDK 在此時打開你創建的專案。 但是,所做的任何編輯你到內 SDK 影響衍生專案設置的資產,不是原始的跨平臺原始程式碼檔。 如果你只是想要初始化一個專案,請使用此方法。 (見如何開發應用程式內每個 SDK 平臺指南的資訊)如果您想使用命令列工具的整個開發週期,請繼續閱讀。 + +## 構建應用程式 + +預設情況下, `cordova create` 腳本生成骨骼肌的以基於 web 的應用,其主頁是該專案的 `www/index.html` 檔。 編輯此應用程式,但是你想要但應作為的一部分指定的任何初始化 `[deviceready](../../cordova/events/events.deviceready.html)` 事件處理常式中,從預設的引用 `www/js/index.js` 。 + +運行以下命令以反覆運算方式生成專案: + + $ cordova build + + +這將生成特定于平臺代碼內專案的 `platforms` 子目錄。你可以選擇限制到特定的平臺每個生成的範圍: + + $ cordova build ios + + +`cordova build`命令是以下,而在此示例中還針對的是一個單一的平臺的簡寫形式: + + $ cordova prepare ios + $ cordova compile ios + + +在這種情況下,一次您運行 `prepare` ,你可以作為備用使用蘋果公司的 Xcode SDK 修改和編譯科爾多瓦在範圍內生成的特定于平臺代碼 `platforms/ios` 。 您可以使用相同的方法與其他平臺的 Sdk。 + +## 測試模擬器或設備上的應用程式 + +移動平臺 Sdk 經常與捆綁在一起執行設備的圖像,以便您可以啟動該應用程式從主畫面並看看它如何與許多平臺功能交互的模擬程式。 運行如下命令來重新生成應用程式並查看它在特定的平臺模擬器內: + + $ cordova emulate android + + +一些移動平臺類比特定設備預設情況下,iPhone 的 iOS 專案等。 對於其他平臺,您可能需要首先將設備模擬程式與相關聯。 (見平臺指南的詳細資訊)。例如,您可能會首先運行 `android` 命令以啟動 Android SDK,然後運行一個特定的設備圖像,啟動它根據其預設行為: + +![][2] + + [2]: {{ site.baseurl }}/static/img/guide/cli/android_emulate_init.png + +跟進與 `cordova emulate` 命令刷新顯示的最新應用,現已從主畫面發射的模擬程式圖像: + +![][3] + + [3]: {{ site.baseurl }}/static/img/guide/cli/android_emulate_install.png + +或者,可以將手機插入您的電腦和直接測試應用程式: + + $ cordova run android + + +在運行此命令之前, 您需要設置的設備進行測試,之後會發生變化,為每個平臺的程式。 在 Android 的情況下,你將必須啟用設備上的**USB 調試**的選項和或許添加 USB 驅動程式根據您發展導讀工作。 每個平臺的要求的詳細資訊,請參閱平臺指南。 + +## 添加功能 + +生成和查看一個新專案時,將顯示預設的應用程式不會很多。 您可以修改該應用程式在許多方面,利用標準的 web 技術,但應用程式緊密的聯繫,與各種設備級功能,您需要添加外掛程式,提供對核心科爾多瓦 Api 的訪問。 + +*外掛程式*是有點的載入項代碼的提供的本機組件的介面。 您可以設計您自己的外掛程式介面,例如,設計一個混合應用程式,與本機組件混合科爾多瓦 web 視圖時。 (請參閱嵌入 WebViews 和外掛程式開發指南的詳細資訊。更常見的是,您將添加外掛程式,使科爾多瓦的基本設備級功能之一 XREF 詳細的 API Reference 中。 + +`cordova plugin add`命令需要您指定的外掛程式代碼的存儲庫。以下是您可能會添加的功能的示例: + +* 基本設備資訊 (設備 API): + + $ cordova plugin add org.apache.cordova.device + + +* 網路連接和電池事件: + + $ cordova plugin add org.apache.cordova.network-information + $ cordova plugin add org.apache.cordova.battery-status + + +* 加速度計、 指南針、 和地理定位: + + $ cordova plugin add org.apache.cordova.device-motion + $ cordova plugin add org.apache.cordova.device-orientation + $ cordova plugin add org.apache.cordova.geolocation + + +* 相機、 媒體重播和捕獲: + + $ cordova plugin add org.apache.cordova.camera + $ cordova plugin add org.apache.cordova.media-capture + $ cordova plugin add org.apache.cordova.media + + +* 訪問設備或網路 (檔 API) 上的檔: + + $ cordova plugin add org.apache.cordova.file + $ cordova plugin add org.apache.cordova.file-transfer + + +* 通過對話方塊或振動發出通知: + + $ cordova plugin add org.apache.cordova.dialogs + $ cordova plugin add org.apache.cordova.vibration + + +* 連絡人: + + $ cordova plugin add org.apache.cordova.contacts + + +* 全球化: + + $ cordova plugin add org.apache.cordova.globalization + + +* 閃屏: + + $ cordova plugin add org.apache.cordova.splashscreen + + +* 打開新的瀏覽器視窗 (InAppBrowser): + + $ cordova plugin add org.apache.cordova.inappbrowser + + +* 調試主控台: + + $ cordova plugin add org.apache.cordova.console + + +使用 `plugin ls` (或 `plugin list` ,或 `plugin` 本身) 查看當前已安裝的外掛程式。每個顯示由其識別碼: + + $ cordova plugin ls # or 'plugin list' + [ 'org.apache.cordova.console' ] + + +若要刪除某個外掛程式,它通過引用相同的識別碼出現在該清單中。例如,這裡是你會怎麼移除調試主控台支援從一個發佈版本: + + $ cordova plugin rm org.apache.cordova.console + $ cordova plugin remove org.apache.cordova.console # same + + +你可以大量刪除或添加的外掛程式通過指定多個參數的每個命令。 + +## 自訂每個平臺 + +而科爾多瓦允許您輕鬆地部署許多不同平臺的應用程式,有時需要添加自訂項。 在這種情況下,你不想修改中各項的原始程式碼檔 `www` 內的頂級目錄 `platforms` 目錄,,因為他們定期更換與頂級 `www` 目錄的跨平臺源。 + +相反,頂級 `merges` 目錄提供了一個指定資產在特定平臺上部署的地方。 每個特定于平臺的子目錄內 `merges` 鏡像的目錄結構的 `www` 源樹中,從而允許您重寫或根據需要添加的檔。 例如,在這裡是如何你可能會使用 `merges` 來提振的 Android 設備的預設字型大小: + +* 編輯 `www/index.html` 檔,添加一個連結到一個額外的 CSS 檔,該檔 `overrides.css` 在這種情況下: + + + + +* (可選) 創建一個空的 `www/css/overrides.css` 檔,將適用于所有非 Android 生成,防止丟失檔錯誤。 + +* 創建 `css` 中的子目錄 `merges/android` ,然後添加相應的 `overrides.css` 檔。 指定將覆蓋 12 點預設的字體大小範圍內指定的 CSS `www/css/index.css` ,例如: + + body { font-size:14px; } + + +當你重新生成專案時,Android 版本功能自訂字體大小,而其他人保持不變。 + +您還可以使用 `merges` 添加中原物不存在的檔 `www` 目錄。 例如,一個應用程式可以納入*後退按鈕*圖形的 iOS 介面,存儲在 `merges/ios/img/back_button.png` ,而 Android 版本可以改為捕獲 `[backbutton](../../cordova/events/events.backbutton.html)` 從相應的硬體按鈕的事件。 + +## 更新科爾多瓦 + +安裝後 `cordova` 實用程式,您可以始終進行更新到最新版本通過運行以下命令: + + $ sudo npm update -g cordova + + +使用此語法來安裝特定的版本: + + $ sudo 故宮安裝-g cordova@3.1.0 + + +運行 `cordova -v` ,查看當前運行的版本。 運行 `npm +info` 命令長清單,其中包含當前版本以及其他可用的版本號: + + $ npm info cordova + + +科爾多瓦 3.0 是要支援這一節中描述的命令列介面的第一個版本。 如果您正在從 3.0 以前的版本更新,您需要創建一個新專案,如以上所述,然後將舊應用程式的資源複製到頂級 `www` 目錄。 在適用的情況,進一步有關升級到 3.0 的詳細資訊是可用的平臺指南中。 一旦你升級到 `cordova` 的命令列介面和使用 `npm update` 待當前,那裡所描述的更耗時過程不再相關。 http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/guide/hybrid/plugins/index.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/guide/hybrid/plugins/index.md b/www/docs/zh-cn/3.1.0/guide/hybrid/plugins/index.md new file mode 100644 index 0000000..c94483f --- /dev/null +++ b/www/docs/zh-cn/3.1.0/guide/hybrid/plugins/index.md @@ -0,0 +1,106 @@ +--- +license: > + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +title: 外掛程式開發指南 +--- + +# 外掛程式開發指南 + +科爾多瓦外掛程式橋樑有點之間供電科爾多瓦應用和科爾多瓦應用程式的本機平臺 web 視圖的功能在運行時。 外掛程式的使用跨所有平臺和以下特定于平臺的外掛程式介面,JavaScript 調用到本機實現一個單一的 JavaScript 介面組成。 所有的科爾多瓦 Api 的核心是使用這種體系結構實現的。 + +本指南的步驟,編寫一個簡單的 Echo 外掛程式的過程傳遞一個字串從 JavaScript,並將它發送到本機環境中有關支援的平臺。 本機代碼然後回裡面的外掛程式 JavaScript 回檔返回相同的字串。 + +本指南提供了足夠的概述,您可以生成來編寫更複雜的外掛程式。 + +## JavaScript + +任何外掛程式的進入點是 JavaScript。 科爾多瓦是這樣他們就可以使用的原因開發人員使用和寫 JavaScript,不客觀-C,不是 JAVA,C#。 你的外掛程式的 JavaScript 介面是你的科爾多瓦外掛程式的正面和可以說是最重要的部分。 + +然而你喜歡,可以設計你的外掛程式 JavaScript 的結構。 您*必須*使用科爾多瓦 JavaScript 和本機環境之間進行通信的一件事是 `cordova.exec` 函數。 下面是一個示例: + + cordova.exec(function(winParam) {}, function(error) {}, "service", + "action", ["firstArgument", "secondArgument", 42, + false]); + + +參數詳述如下: + +* `function(winParam) {}`: 成功回呼函數。 假設您 `exec` 調用成功完成,調用此函數時 (可以選擇與您傳遞回給它的任何參數)。 + +* `function(error) {}`: 錯誤函數回檔。如果該操作未成功完成,調用此函數時 (可以選擇與錯誤參數)。 + +* `"service"`: 要調用的本機一邊的服務名稱。這被映射到本機類,有關的更多資料,可在下面列出的本機指南。 + +* `"action"`: 要調入的操作名稱。 這由本機類接收拾 `exec` 調用,並且,取決於平臺,基本上將映射到類的方法。 下面列出的本機指南提供詳細資訊。 + +* `[/* arguments */]`: 要傳遞到本機環境中的參數。 + +### Echo 外掛程式的 JavaScript 示例 + + window.echo = function(str, callback) { + cordova.exec(callback, function(err) { + callback('Nothing to echo.'); + }, "Echo", "echo", [str]); + }; + + +讓我們深入到這。該外掛程式的重視本身到 `window` ,具體到 `echo` 函數。外掛程式使用者將然後使用,如下所示: + + window.echo("echome", function(echoValue) { + alert(echoValue == "echome"); // should alert true. + }); + + +首先,讓我們看看的最後三個參數的 `exec` 函數。 我們將調用 `Echo` "服務、"請求 `echo` "行動",和傳遞的參數包含 echo 字串的陣列,這是進入的第一個參數 `window.echo` 函數。 + +成功回檔傳遞到 `exec` 是只是提到該回呼函數的 `window.echo` 需要。 我們多做一點為錯誤回檔: 如果本機端觸發錯誤回檔,我們只需調用成功回呼函數,並傳遞到它"的預設"的字串。 + +## 外掛程式規範 + +科爾多瓦有可用於啟用該外掛程式為 Android、 iOS、 黑莓 10 和 Windows Phone 平臺的自動的安裝一個外掛程式規範。 通過以特定方式構建你的外掛程式,添加 `plugin.xml` 清單檔,您可以使使用者能夠安裝你的外掛程式通過命令列工具。 + +* [外掛程式規範](../../../plugin_ref/spec.html) + +## 本機 + +一旦你為你的外掛程式定義 JavaScript,你需要至少一個本機實現,補充。 下面列出了這樣做為每個平臺的詳細資訊。 這些指南繼續在上文討論過的簡單回聲外掛程式示例上。 + +* [Android 外掛程式](../../platforms/android/plugin.html) +* [黑莓手機的外掛程式](../../platforms/blackberry/plugin.html) +* [黑莓 10 外掛程式](../../platforms/blackberry10/plugin.html) +* [iOS 外掛程式](../../platforms/ios/plugin.html) +* [Windows Phone 外掛程式](../../platforms/wp8/plugin.html) + +當前,Tizen 平臺不支援外掛程式。 + +## 發佈外掛程式 + +一旦你制定你的外掛程式,你可能想要發佈它,並與社區共用它。 你可以將你的外掛程式發佈到科爾多瓦註冊表 (基於[npmjs][1]) 或任何其他 npmjs 的基於註冊表。 使用者將能夠將它使用 plugman 或科爾多瓦 cli 自動安裝。 + + [1]: https://github.com/isaacs/npmjs.org + +要發佈一個外掛程式你需要使用 plugman 工具,並通過以下步驟: + + $ plugman adduser # that is if you don't have an account yet + $ plugman publish /path/to/your/plugin + + +就這麼簡單 ! + +其他基於註冊表的命令都可用和 `plugman --help` 會給你什麼命令都可以使用和如何使用它們的清單。 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/guide/hybrid/webviews/index.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/guide/hybrid/webviews/index.md b/www/docs/zh-cn/3.1.0/guide/hybrid/webviews/index.md new file mode 100644 index 0000000..05c8c08 --- /dev/null +++ b/www/docs/zh-cn/3.1.0/guide/hybrid/webviews/index.md @@ -0,0 +1,28 @@ +--- +license: > + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +title: 嵌入 WebViews +--- + +# 嵌入 WebViews + +> 在您自己的專案中實現科爾多瓦 web 視圖。 + +* [Android WebViews](../../platforms/android/webview.html) +* [WebViews iOS](../../platforms/ios/webview.html) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/guide/overview/index.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/guide/overview/index.md b/www/docs/zh-cn/3.1.0/guide/overview/index.md new file mode 100644 index 0000000..4b8df3d --- /dev/null +++ b/www/docs/zh-cn/3.1.0/guide/overview/index.md @@ -0,0 +1,709 @@ +--- +license: > + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +title: 概述 +--- + +# 概述 + +科爾多瓦是一個開放源碼移動開發框架。 它允許您使用標準的 web 技術如 HTML5、 CSS3 和 JavaScript 進行跨平臺開發,避免每個移動平臺的本機開發語言。 應用程式在有針對性的對每個平臺的包裝內執行,並依靠符合標準的 API 綁定訪問每個設備的感應器、 資料和網路狀態。 + +如果您是,使用科爾多瓦: + +* 移動開發人員和想要擴展應用程式跨多個平臺,而無需重新實現它與每個平臺的語言和工具集。 + +* 網頁程式開發人員和想要部署 web 應用程式打包為分佈在各種應用程式中存儲的門戶。 + +* 移動開發人員感興趣混合本機應用程式中的元件與*web 視圖*(瀏覽器視窗),可以訪問設備級的 Api,或者如果您想要開發的外掛程式介面本機和 web 視圖元件之間。 + +## 基本元件 + +科爾多瓦的應用程式都依賴于一個共同的 `config.xml` 檔,提供有關應用程式的資訊,並指定參數影響它如何工作,如它是否回應方向轉移。 此檔遵循 W3C 的[打包 Web 應用程式][1]或*構件*,規範。 + + [1]: http://www.w3.org/TR/widgets/ + +應用程式本身是作為 web 頁來實現,預設情況下,引用任何 CSS、 JavaScript、 圖像、 媒體檔案,命名*index.html*或其他資源是它運行的必要條件。 這款應用程式作為*web 視圖*的本機應用程式中包裝,您分發給應用程式商店內執行。 為 web 應用程式進行交互的方式本機應用程式做的各項裝置功能,它也必須引用 `cordova.js` 檔,該檔提供 API 綁定。 + +科爾多瓦啟用 web 視圖可提供具有其整個使用者介面的應用程式。 它也可以是更大,混合應用程式與本機應用程式元件混合 web 視圖中的一個元件。 科爾多瓦提供*外掛程式*介面,使這些元件,以互相溝通。 + +## 發展路徑 + +設置應用程式的最簡單方法是運行 `cordova` 命令列實用程式,也稱為*命令列介面*(CLI)。 (若要安裝 CLI,參見命令列介面。根據您想要的目標的平臺的集,您可以依靠逐步更多地共用在開發週期的 CLI: + +* 在最基本的情況下,你可以使用 CLI 只是為了創建一個新專案填充,您要修改的預設配置。 + +* 對於很多的移動平臺,也可以使用 CLI 來設置內部每個 SDK 編譯所需的額外的專案檔案。 為此,您必須安裝每個目標的平臺 SDK。 (見平臺指南的說明)。如表中所示的平臺支援下,您可能需要在目標平臺根據不同的作業系統上運行,CLI。 + +* 為支援平臺,CLI 可以編譯 executible 的應用程式和基於 SDK 的設備模擬程式中運行它們。 為全面的測試,還可以生成應用程式檔,直接在設備上安裝它們。 + +在開發週期中的任何點,你也可以依賴特定于平臺的 SDK 工具,可提供一組更豐富的選項。 (見有關每個平臺 SDK 工具的詳細資訊平臺指南設置)。SDK 環境是更適當的如果你想要實現一個混合本機和基於 web 的應用程式元件的混合應用。 你可以使用命令列實用程式最初生成應用程式,或以反覆運算方式此後要喂 SDK 工具更新的代碼。 您也可以自己生成應用程式的設定檔。 + + + +## 平臺支援 + +下面顯示一的組開發工具和設備的 Api 可為每個移動平臺。(列標題顯示的 CLI 速記存根 (stub)。 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + android 系統 + + 黑莓手機() 6 + + blackberry10 + + ios + + wp7(Windows
電話 7) +
+ wp8(Windows
電話 8) +
+ win8
(Windows 8) +
+ firefoxos + + tizen +
+ 科爾多瓦
CLI
+
+ Mac、 Windows、 Linux + + Mac Windows + + Mac Windows + + Mac + + Windows + + Windows + + +
+ 嵌入式
Web 視圖
+
+ (請參閱詳細資訊) + + + + (請參閱詳細資訊) + + + + +
+ 外掛程式
介面
+
+ (請參閱詳細資訊) + + (請參閱詳細資訊) + + (請參閱詳細資訊) + + (請參閱詳細資訊) + + (請參閱詳細資訊) + + + +
+ + 平臺 Api +
+ 加速度計 + + + + + + + + +
+ 相機 + + + + + + + + +
+ 捕獲 + + + + + + + + +
+ 指南針 + + + + + (3GS) + + + + + +
+ 連接 + + + + + + + + +
+ 連絡人 + + + + + + + + +
+ 設備 + + + + + + + + +
+ 事件 + + + + + + + + +
+ + + + + + + 沒有檔案傳輸 + + 沒有檔案傳輸 + + +
+ 地理定位 + + + + + + + + +
+ 全球化 + + + + + + + + +
+ InAppBrowser + + + + + + + + +
+ 媒體 + + + + + + + + +
+ 通知 + + + + + + + + +
+ 閃屏 + + + + + + + + +
+ 存儲 + + + + + + 認為只有 + + 認為只有 + + +
+ + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/guide/platforms/android/config.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/guide/platforms/android/config.md b/www/docs/zh-cn/3.1.0/guide/platforms/android/config.md new file mode 100644 index 0000000..f53ef26 --- /dev/null +++ b/www/docs/zh-cn/3.1.0/guide/platforms/android/config.md @@ -0,0 +1,59 @@ +--- +license: > + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +title: Android 系統組態 +--- + +# Android 系統組態 + +`config.xml`檔控制應用於每個應用程式和 CordovaWebView 實例的應用程式的基本設置。 本節詳細說明僅適用于 android 系統生成的首選項。 有關全域配置選項,請參閱 config.xml 檔的資訊。 + +* `KeepRunning`(boolean 類型的值,預設值為 `true` ): 確定應用程式是否保持甚至後在後臺運行 `pause` 事件火災。 + + + + +* `ErrorUrl`: 指定顯示在 400-500 範圍內的標準 HTTP 錯誤回應的錯誤頁。 將指定的檔放在包含主頁和其他 web 資產的頂級目錄。 + + + + +* `LoadingDialog`: 顯示本機對話方塊載入應用程式時。值的格式是*標題、 消息* + + + + +* `LoadingPageDialog`: 載入一個應用程式內的子頁面時顯示本機的對話方塊。值的格式是*標題、 消息* + + + + +* `LoadUrlTimeoutValue`(數,預設值是 `20000` ): 當載入一個頁面,在引發逾時錯誤之前等待的時間量。 此示例指定 10 秒,而不是 20: + + + + +* `SplashScreen`: 減去其副檔名的檔的名稱 `res/drawable` 目錄。各種資產必須共用此各子目錄中的共同名稱。 + + + + +* `SplashScreenDelay`(編號,預設值為 `5000` ): 所需的時間初始螢幕圖像顯示。 + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/guide/platforms/android/index.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/guide/platforms/android/index.md b/www/docs/zh-cn/3.1.0/guide/platforms/android/index.md new file mode 100644 index 0000000..533e456 --- /dev/null +++ b/www/docs/zh-cn/3.1.0/guide/platforms/android/index.md @@ -0,0 +1,194 @@ +--- +license: > + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +title: Android 平臺指南 +--- + +# Android 平臺指南 + +本指南介紹如何設置您的 SDK 開發環境部署科爾多瓦的 Android 設備的應用程式。請參閱下列特定于平臺的詳細資訊: + +* [Android 系統組態](config.html) +* [Android WebViews](webview.html) +* [Android 外掛程式](plugin.html) +* [升級 Android](upgrading.html) +* [Android 系統的命令列工具](tools.html) + +上面的命令列工具請參閱科爾多瓦 3.0 以前的版本。關於當前介面的資訊,請參閱命令列介面。 + +## 要求和支援 + +Android SDK,請參閱[系統要求][1]。 + + [1]: http://developer.android.com/sdk/index.html + +科爾多瓦支援 Android 2.2、 2.3 和 4.x。作為一般規則,平臺已棄用作為他們低於 5%的谷歌的[分佈的儀表板][2]. + + [2]: http://developer.android.com/about/dashboards/index.html + + + +開發人員應使用 `cordova` 實用程式與 Android SDK 一起。 命令列介面資訊,請參閱如何安裝它,添加專案,然後生成和部署專案。 + +## 安裝 SDK + +從[developer.android.com/sdk][3]安裝 Android SDK。 你可能會出現一個選擇在哪裡安裝 SDK,否則移動下載 `adt-bundle` 樹到無論您存儲的開發工具。 + + [3]: http://developer.android.com/sdk/ + +科爾多瓦命令列工具來工作,您需要包括 SDK 的 `tools` 和 `platform-tools` 的路徑環境中目錄。 在 Mac 上可以使用文字編輯器來創建或修改 `~/.bash_profile` 檔中,添加行,如下,根據 SDK 的安裝位置: + + export PATH=${PATH}:/Development/adt-bundle/sdk/platform-tools:/Development/adt-bundle/sdk/tools + + +這暴露了 SDK 工具在新打開的終端視窗。否則運行這使它們在當前會話中可用: + + $ source ~/.bash_profile + + +若要修改路徑上 Windows 7 的環境: + +* 在桌面的左下角的**開始**功能表上按一下,在**電腦**上,按右鍵,然後按一下**屬性**. + +* 在左側列中,按一下**高級系統設置**。 + +* 在結果對話方塊中,按下**環境變數**. + +* 選擇**PATH**變數,然後按**編輯**. + +* 將以下內容追加到基於例如安裝 SDK 的位置的路徑: + + ;C:\Development\adt-bundle\sdk\platform-tools ;C:\Development\adt-bundle\sdk\tools + + +* 將值保存並關閉這兩個對話方塊。 + +您可能還需要啟用 JAVA 和螞蟻打開一個命令提示符並鍵入 `java` ,然後還鍵入 `ant` 。將追加到該路徑無法運行的日期為准: + + ; %JAVA_HOME%\bin;%ANT_HOME%\bin + + +## 在 SDK 中打開的專案 + +使用 `cordova` 實用程式設置了一個新的專案,如所述在科爾多瓦命令列介面。例如,在原始程式碼中的目錄: + + $ 科爾多瓦創建你好 com.example.hello"HelloWorld"$ cd 你好 $ 科爾多瓦平臺添加 android $ 科爾多瓦生成 + + +一旦創建了,這裡是如何使用 SDK 來修改它: + +* 啟動**Eclipse**應用程式。 + +* 選擇**新建專案**功能表項目。 + +* 從結果對話方塊中,選擇**從現有代碼的 Android 專案**並按**下一步**: ![][4] + +* 定位到 `hello` ,或無論你創建目錄的專案,然後到 `platforms/android` 子目錄。 + +* 按**完成**. + + [4]: {{ site.baseurl }}/static/img/guide/platforms/android/eclipse_new_project.png + +一旦日食視窗將打開,一個紅色的**X**可能似乎表明未解決的問題。如果是這樣,執行這些額外的步驟: + +* 按右鍵專案目錄。 + +* 在出現的**屬性**對話方塊中,選擇**Android**從功能窗格。 + +* 為專案生成目標,選擇您已安裝的最高的 Android API 級別。 + +* 按一下**確定**. + +* 從**專案**功能表中選擇**清潔**。這應該更正該專案中的所有錯誤。 + +## 部署到模擬程式 + +您可以使用 `cordova` 實用程式在一個模擬程式,或你運行一個應用程式可以在 SDK 內運行它。 不管怎樣,SDK 必須首先配置以顯示至少一個設備。 若要這樣做,請使用 Android SDK 經理,從 Eclipse 獨立運行的 JAVA 應用程式。 有兩種方法來打開它: + +* 運行 `android` 命令列上。 + +* 從內日食,按此工具列圖示: + + ![][5] + + [5]: {{ site.baseurl }}/static/img/guide/platforms/android/eclipse_android_sdk_button.png + +一旦打開,Android SDK 管理器將顯示不同的運行時庫: + +![][6] + + [6]: {{ site.baseurl }}/static/img/guide/platforms/android/asdk_window.png + +選擇**工具 → 管理 AVDs** (Android 的虛擬裝置),然後從**裝置定義**在隨後出現的對話方塊中選擇任何項: + +![][7] + + [7]: {{ site.baseurl }}/static/img/guide/platforms/android/asdk_device.png + +新聞**創建 AVD**,(可選) 修改該名稱,然後按**確定**以接受這些更改: + +![][8] + + [8]: {{ site.baseurl }}/static/img/guide/platforms/android/asdk_newAVD.png + +AVD 然後出現在**虛擬的 Android 設備**清單中: + +![][9] + + [9]: {{ site.baseurl }}/static/img/guide/platforms/android/asdk_avds.png + +若要打開模擬器作為單獨的應用程式,選擇 AVD 然後按**開始**。它發射將在設備上,與其他控制項可用的硬體按鈕: + +![][10] + + [10]: {{ site.baseurl }}/static/img/guide/platforms/android/asdk_emulator.png + +此時你可以使用 `cordova` 實用程式將應用部署到模擬程式從命令列: + + $ 科爾多瓦效仿 android + + +如果改為你使用的日食,按右鍵該專案,並選擇**運行作為 → Android 應用程式**。可能要求您指定 AVD,如果都已經打開。 + +為獲得更快的體驗,使用基於英特爾的模擬程式映射: + +* 安裝一個或多個 `Intel x86 Atom` 的系統映射,以及 `Intel Hardware Accelerated Execution Manager` 下**的額外**的可用. + +* 運行英特爾安裝程式時,這是在您 Android SDK 內可用`extras/intel/Hardware_Accelerated_Execution_Manager`. + +* 設置為英特爾圖像的目標來創建新的 AVD。 + +* 當啟動模擬程式,確保沒有任何錯誤訊息,指示未能載入 HAX 模組。 + +## 將部署到設備 + +要將應用程式推直接到設備,請確保您的設備上的[Android 開發者網站][11],所述上啟用 USB 調試和使用一個迷你 USB 電纜,將其插入您的系統。 + + [11]: http://developer.android.com/tools/device.html + +從命令列,可以將應用程式推送到設備: + + 運行 android 的 $ 科爾多瓦 + + +交替內日食,按右鍵該專案並選擇**作為 → 運行 Android 應用程式**. http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/guide/platforms/android/plugin.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/guide/platforms/android/plugin.md b/www/docs/zh-cn/3.1.0/guide/platforms/android/plugin.md new file mode 100644 index 0000000..0cb9438 --- /dev/null +++ b/www/docs/zh-cn/3.1.0/guide/platforms/android/plugin.md @@ -0,0 +1,166 @@ +--- +license: > + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +title: Android 外掛程式 +--- + +# Android 外掛程式 + +在編寫外掛程式,需要瞭解的科爾多瓦 android 系統的體系結構。 科爾多瓦 Android 包括 Android 的 web 視圖與附加到它上面的鉤子。 這些外掛程式都表示為類映射的 `config.xml` 檔。 + +外掛程式包括至少一個擴展的 JAVA 類的 `CordovaPlugin` 類。 外掛程式必須重寫的一個 `execute` 方法從 `CordovaPlugin` 。 作為最佳實踐,該外掛程式應處理 `pause` 和 `resume` 的事件和任何外掛程式之間傳遞的消息。 外掛程式需要長時間運行的請求,後臺活動媒體重播、 聽眾或內部狀態等應執行 `onReset()` ,以及方法。 它執行時 `WebView` 定位到新的一頁或刷新,重新載入 JavaScript。 + +## 外掛程式類映射 + +一個外掛程式的 JavaScript 部分始終使用 `cordova.exec` 方法,如下所示: + + exec(, , , , []); + + +這封送從 web 視圖到 Android 的本機方面,更多或更少沸騰到調用請求 `action` 上的方法 `service` 類,傳入的參數中的 `args` 陣列。 + +是否您分發你的外掛程式作為 JAVA 檔或一罐,必須將該外掛程式添加到 `config.xml` 檔在科爾多瓦 Android 應用程式的 `res/xml/` 目錄。 + + + + + + +服務名稱應與匹配在 JavaScript 中使用 `exec` 的電話和值是 JAVA 類完整名稱,包括命名空間。 否則為該外掛程式可編譯,但仍無法訪問由科爾多瓦。 + +## 編寫一個 Android JAVA 外掛程式 + +JavaScript 觸發外掛程式到本機端的請求。Android JAVA 外掛程式正確映射通過 `config.xml` 檔。所以最終的 Android JAVA 外掛程式類長什麼樣子? + +什麼獲取調度到該外掛程式通過 JavaScript 的 `exec` 函數獲取傳遞到外掛程式類的 `execute` 方法。 大多數 `execute` 實現看起來像這樣: + + @Override 公共 boolean 類型的值執行 CallbackCoNtext callbackCoNtext JSONArray args 字串操作) 將引發 JSONException {如果 ("beep".equals(action)) {this.beep(args.getLong(0));callbackCoNtext.success() ;則返回 true ;} 返回 false ;/ / 返回 false 結果的"MethodNotFound"錯誤。 + } + + +我們比較的值的 `action` 參數,並派遣到 (私人) 方法在類中,可以選擇將某些參數傳遞給方法關閉請求。 + +當捕獲異常,並返回錯誤,重要的是為了明確起見,錯誤返回給 JavaScript 匹配 JAVA 異常名稱盡可能多。 + +### 執行緒 + +在 web 視圖中的 JavaScript 並*不*在 UI 執行緒上運行。它在測試網執行緒上運行。`execute`還在測試網執行緒上運行方法。 + +如果您需要與使用者介面進行交互,您應該使用以下方法: + + @Override + public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException { + if ("beep".equals(action)) { + final long duration = args.getLong(0); + cordova.getActivity().runOnUiThread(new Runnable() { + public void run() { + ... + callbackContext.success(); // Thread-safe. + } + }); + return true; + } + return false; + } + + +如果你不需要在 UI 執行緒上運行,但不是想阻止測試網線: + + @Override + public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException { + if ("beep".equals(action)) { + final long duration = args.getLong(0); + cordova.getThreadPool().execute(new Runnable() { + public void run() { + ... + callbackContext.success(); // Thread-safe. + } + }); + return true; + } + return false; + } + + +### 回聲 Android 外掛程式示例 + +添加以下內容我們 `config.xml` 檔: + + + + + + +然後將添加到下面的檔 `src/org/apache/cordova/plugin/Echo.java` 裡面我們的科爾多瓦 Android 應用程式: + + package org.apache.cordova.plugin; + + import org.apache.cordova.CordovaPlugin; + import org.apache.cordova.CallbackContext; + + import org.json.JSONArray; + import org.json.JSONException; + import org.json.JSONObject; + + /** + * This class echoes a string called from JavaScript. + */ + public class Echo extends CordovaPlugin { + + @Override + public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { + if (action.equals("echo")) { + String message = args.getString(0); + this.echo(message, callbackContext); + return true; + } + return false; + } + + private void echo(String message, CallbackContext callbackContext) { + if (message != null && message.length() > 0) { + callbackContext.success(message); + } else { + callbackContext.error("Expected one non-empty string argument."); + } + } + } + + +讓我們看看代碼。 必要的 `imports` 在頂部。 我們班從延伸 `CordovaPlugin` 。 我們重 execute() 方法,以便從 exec() 接收消息。 我們的方法首先比較反對 `action` : 這個外掛程式只支援一個操作, `echo` 行動。 任何其他行動返回 `false` ,這會導致錯誤的類型 `INVALID_ACTION` ,其中將轉化為一個錯誤回檔調用的 JavaScript 一邊。 下一步,我們抓住 echo 字串使用 `getString` 方法上的我們 `args` ,告訴它我們想要獲取參數陣列中的第十的參數。 我們做一些參數檢查: 請確保它不是 `null` ,並確保它不是一個零長度的字串。 如果是,我們稱之為 `callbackContext.error()` (其中,現在,你應該知道調用錯誤回檔)。 如果所有這些檢查通過,然後我們調用 `callbackContext.success()` ,並通過在 `message` 我們收到作為參數的字串。 這最後轉化為一個成功回檔調用的 JavaScript 一邊。 它還� ��過 `message` 參數作為入 JavaScript 成功回呼函數的參數。 + +## 調試外掛程式 + +Eclipse 可以用於調試 Android 專案,並可以調試外掛程式,如果 JAVA 原始程式碼包含在專案中。 已知只有最新版本的 Android 開發者工具是允許來原始程式碼附件 JAR 的依賴關係,所以這不完全支援在這一次。 + +## 常見的陷阱 + +* 外掛程式可以訪問 `CordovaInterface` 物件。 此物件具有對 Android 的訪問 `Activity` ,在運行該應用程式。 這是 `Context` 啟動新的 android 系統所需 `Intent` 。 `CordovaInterface`允許外掛程式啟動 `Activity` 一個結果,並設置回檔外掛程式時 `Intent` 回來到應用程式。 這是重要的因為 `Intent` s 系統是 android 系統進程之間的通信。 + +* 外掛程式並沒有直接存取 `Context` 因為他們在過去。 遺留下來 `ctx` 成員已棄用,並將移除 2.0 發表後六個月。 所有的 `ctx` 方法上存在 `Context` ,所以這兩個 `getContext()` 和 `getActivity()` 都能夠返回所需的適當物件。 + +## 使用源 + +準備好自己要寫你自己的外掛程式的最佳方法之一是[看看現有的外掛程式][1]. + + [1]: https://github.com/apache/cordova-android/tree/master/framework/src/org/apache/cordova + +您還應閱讀通過在[CordovaPlugin.java][2]中的評論. + + [2]: https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaPlugin.java \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/guide/platforms/android/tools.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/guide/platforms/android/tools.md b/www/docs/zh-cn/3.1.0/guide/platforms/android/tools.md new file mode 100644 index 0000000..4200f22 --- /dev/null +++ b/www/docs/zh-cn/3.1.0/guide/platforms/android/tools.md @@ -0,0 +1,72 @@ +--- +license: > + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +title: Android 系統的命令列工具 +--- + +# Android 系統的命令列工具 + +`cordova`命令列實用程式是一個高級別的工具,允許您在一次跨幾個平臺生成的應用程式。 舊版本的科爾多瓦框架提供了特定于每個平臺的命令列工具集。 若要使用它們作為 CLI 的替代,您需要從[cordova.apache.org][1]下載此版本的科爾多瓦。 下載檔案中包含單獨的檔案,為每個平臺。 展開您想要的目標平臺。 這裡描述的工具,通常可用在頂級 `bin` 目錄中,否則為諮詢**自述**檔,瞭解有關更多詳細的指示。 + + [1]: http://cordova.apache.org + +## 創建一個專案 + +運行 `create` 命令,指定的現有路徑的專案、 反向域式包識別碼和應用程式的顯示名稱。這裡是 Mac 和 Windows 的語法: + + $ /path/to/cordova-android/bin/create /path/to/project com.example.project_name ProjectName + $ C:\path\to\cordova-android\bin\create.bat C:\path\to\project com.example.project_name ProjectName + + +## 生成 + +此清理,然後生成專案。 + +在 Mac 或 Windows 上調試: + + $ /path/to/project/cordova/build --debug + $ C:\path\to\project\cordova\build.bat --debug + + +釋放,Mac 或 Windows 上: + + $ /path/to/project/cordova/build --release + $ C:\path\to\project\cordova\build.bat --release + + +## 運行應用程式 + +`run`命令接受下列*可選*的參數: + +* 目標規範。這包括 `--emulator` , `--device` ,或`--target=`. + +* 生成規范。這包括 `--debug` , `--release` ,或`--nobuild`. + + \[目標\] \[生成\] $ /path/to/project/cordova/run $ C:\path\to\project\cordova\run.bat \[目標\] \[生成\] + +請確保您創建至少一個 Android 虛擬裝置,否則為系統會提示您這樣與做 `android` 命令。 如果多個 AVD 可用作為目標,提示您選擇一個。 預設情況下 `run` 命令檢測連接的設備或當前正在運行的模擬程式,如果沒有設備發現。 + +## 日誌記錄 + + $ /path/to/project/cordova/log $ C:\path\to\project\cordova\log.bat + + +### 清洗 + + $ /path/to/project/cordova/clean $ C:\path\to\project\cordova\clean.bat \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/guide/platforms/android/upgrading.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/guide/platforms/android/upgrading.md b/www/docs/zh-cn/3.1.0/guide/platforms/android/upgrading.md new file mode 100644 index 0000000..472b870 --- /dev/null +++ b/www/docs/zh-cn/3.1.0/guide/platforms/android/upgrading.md @@ -0,0 +1,417 @@ +--- +license: > + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +title: 升級 Android +--- + +# 升級 Android + +本指南演示如何修改 Android 專案從科爾多瓦的舊版本進行升級。 大多數這些說明適用于與舊集的前面的命令列工具創建的專案 `cordova` CLI 實用程式。 命令列介面資訊,請參閱如何更新的 CLI 版本。 + +## 從 3.0.0 升級到 3.1.0 + +為創建的科爾多瓦 CLI 的專案: + +1. 更新 `cordova` CLI 版本-請參閱命令列介面 +2. 運行`cordova platform update android` + +對於不使用 CLI 科爾多瓦創建的專案,請運行: + +1. `bin/更新 < project_path >` + +## 從 2.9.0 升級到 CLI (3.0.0) + +1. 創建新的 Apache 科爾多瓦 3.0.0 專案使用 CLI,科爾多瓦,如所述的命令列介面。 + +2. 添加您的平臺的科爾多瓦專案,例如:`cordova +platform add android`. + +3. 您的專案的內容複寫 `www` 到目錄 `www` 目錄在您剛剛創建的科爾多瓦專案的根目錄。 + +4. 將本機的任何資產從舊專案複製到相應的目錄下 `platforms/android` : 此目錄是您的本機科爾多瓦 android 專案存在的地方。 + +5. 使用科爾多瓦 CLI 工具來安裝您需要的任何外掛程式。請注意 CLI 處理所有核心 Api 作為外掛程式,所以他們可能需要添加。只有 3.0.0 外掛程式是與 CLI 相容。 + +## 從 2.9.0 升級到 3.0.0 + +1. 創建一個新的 Apache 科爾多瓦 Android 專案。 + +2. 將複製的內容你 `www` 目錄到新的專案。 + +3. 複製任何本機的 Android 資產從您 `res` 目錄到新的專案。 + +4. 複製在你安裝從任何外掛程式 `src` 子目錄到新專案。 + +5. 請確保要升級任何棄用 `` 從你的舊的引用 `config.xml` 到新檔 `` 規範。 + +6. 更新對任何引用 `org.apache.cordova.api` 包被`org.apache.cordova`. + +* **注:**所有核心 Api 已被移除,必須作為外掛程式安裝。請有關詳細資訊,參閱管理外掛程式指南的使用 Plugman。 + +## 從 2.8.0 升級到 2.9.0 + +1. 運行`bin/update `. + +## 從 2.7.0 升級到 2.8.0 + +1. 刪除 `cordova-2.7.0.jar` 從專案的 `libs` 目錄。 + +2. 添加 `cordova-2.8.0.jar` 到專案中的 `libs` 目錄。 + +3. 如果您正在使用 Eclipse,請刷新您的 eclipse 專案,做清潔。 + +4. 複製新 `cordova.js` 到您的專案。 + +5. 更新您的 html 代碼,使用新的 `cordova.js` 檔。 + +6. 複製 `res/xml/config.xml` 檔,以匹配`framework/res/xml/config.xml`. + +7. 更新 `framework/res/xml/config.xml` 以前一樣有類似的設置。 + +8. 將檔從複製 `bin/templates/cordova` 到專案中的 `cordova` 目錄。 + +## 從 2.6.0 升級到 2.7.0 + +1. 刪除 `cordova-2.6.0.jar` 從專案的 `libs` 目錄。 + +2. 添加 `cordova-2.7.0.jar` 到專案中的 `libs` 目錄。 + +3. 如果您正在使用 Eclipse,請刷新您的 eclipse 專案,做清潔。 + +4. 複製新 `cordova-2.7.0.js` 到您的專案。 + +5. 更新您的 html 代碼,使用新的 `cordova-2.7.0.js` 檔。 + +6. 複製 `res/xml/config.xml` 以匹配`framework/res/xml/config.xml`. + +7. 更新 `framework/res/xml/config.xml` 以前一樣有類似的設置。 + +8. 將檔從複製 `bin/templates/cordova` 到專案中的 `cordova` 目錄。 + +## 從 2.5.0 升級到 2.6.0 + +1. 刪除 `cordova-2.5.0.jar` 從專案的 `libs` 目錄。 + +2. 添加 `cordova-2.6.0.jar` 到專案中的 `libs` 目錄。 + +3. 如果您正在使用 Eclipse,請刷新您的 eclipse 專案,做清潔。 + +4. 複製新 `cordova-2.6.0.js` 到您的專案。 + +5. 更新您的 html 代碼,使用新的 `cordova-2.6.0.js` 檔。 + +6. 複製 `res/xml/config.xml` 以匹配`framework/res/xml/config.xml`. + +7. 更新 `framework/res/xml/config.xml` 以前一樣有類似的設置。 + +8. 將檔從複製 `bin/templates/cordova` 到專案中的 `cordova` 目錄。 + +運行 `bin/update ` 的專案路徑與科爾多瓦原始目錄中列出。 + +## 從 2.4.0 升級到 2.5.0 + +1. 刪除 `cordova-2.4.0.jar` 從專案的 `libs` 目錄。 + +2. 添加 `cordova-2.5.0.jar` 到專案中的 `libs` 目錄。 + +3. 如果您正在使用 Eclipse,請刷新您的 eclipse 專案,做清潔。 + +4. 複製新 `cordova-2.5.0.js` 到您的專案。 + +5. 更新您的 html 代碼,使用新的 `cordova-2.5.0.js` 檔。 + +6. 複製 `res/xml/config.xml` 以匹配`framework/res/xml/config.xml`. + +7. 更新 `framework/res/xml/config.xml` 以前一樣有類似的設置。 + +8. 將檔從複製 `bin/templates/cordova` 到專案中的 `cordova` 目錄。 + +## 從 2.3.0 升級到 2.4.0 + +1. 刪除 `cordova-2.3.0.jar` 從專案的 `libs` 目錄。 + +2. 添加 `cordova-2.4.0.jar` 到專案中的 `libs` 目錄。 + +3. 如果您正在使用 Eclipse,請刷新您的 eclipse 專案,做清潔。 + +4. 複製新 `cordova-2.4.0.js` 到您的專案。 + +5. 更新您的 html 代碼,使用新的 `cordova-2.4.0.js` 檔。 + +6. 複製 `res/xml/config.xml` 以匹配`framework/res/xml/config.xml`. + +7. 將檔從複製 `bin/templates/cordova` 到專案中的 `cordova` 目錄。 + +## 從 2.2.0 升級到 2.3.0 + +1. 刪除 `cordova-2.2.0.jar` 從專案的 `libs` 目錄。 + +2. 添加 `cordova-2.3.0.jar` 到專案中的 `libs` 目錄。 + +3. 如果您正在使用 Eclipse,請刷新您的 eclipse 專案,做清潔。 + +4. 複製新 `cordova-2.3.0.js` 到您的專案。 + +5. 更新您的 html 代碼,使用新的 `cordova-2.3.0.js` 檔。 + +6. 複製 `res/xml/config.xml` 以匹配`framework/res/xml/config.xml`. + +7. 將檔從複製 `bin/templates/cordova` 到專案中的 `cordova` 目錄。 + +## 從 2.1.0 升級到 2.2.0 + +1. 刪除 `cordova-2.1.0.jar` 從專案的 `libs` 目錄。 + +2. 添加 `cordova-2.2.0.jar` 到專案中的 `libs` 目錄。 + +3. 如果您正在使用 Eclipse,請刷新您的 eclipse 專案,做清潔。 + +4. 複製新 `cordova-2.2.0.js` 到您的專案。 + +5. 更新您的 html 代碼,使用新的 `cordova-2.2.0.js` 檔。 + +6. 複製 `res/xml/config.xml` 以匹配`framework/res/xml/config.xml`. + +7. 將檔從複製 `bin/templates/cordova` 到專案中的 `cordova` 目錄。 + +## 從 2.0.0 升級到 2.1.0 + +1. 刪除 `cordova-2.0.0.jar` 從專案的 `libs` 目錄。 + +2. 添加 `cordova-2.1.0.jar` 到專案中的 `libs` 目錄。 + +3. 如果您正在使用 Eclipse,請刷新您的 eclipse 專案,做清潔。 + +4. 複製新 `cordova-2.1.0.js` 到您的專案。 + +5. 更新您的 html 代碼,使用新的 `cordova-2.1.0.js` 檔。 + +6. 複製 `res/xml/config.xml` 以匹配`framework/res/xml/config.xml`. + +7. 將檔從複製 `bin/templates/cordova` 到專案中的 `cordova` 目錄。 + +## 從 1.9.0 升級到 2.0.0 + +1. 刪除 `cordova-1.9.0.jar` 從專案的 `libs` 目錄。 + +2. 添加 `cordova-2.0.0.jar` 到專案中的 `libs` 目錄。 + +3. 如果您正在使用 Eclipse,請刷新您的 eclipse 專案,做清潔。 + +4. 複製新 `cordova-2.0.0.js` 到您的專案。 + +5. 更新您的 html 代碼,使用新的 `cordova-2.0.0.js` 檔。 + +6. 複製 `res/xml/config.xml` 以匹配`framework/res/xml/config.xml`. + +### 注意到關於 2.0.0 發佈 + +`config.xml`將會更換 `cordova.xml` 和 `plugins.xml` 。 這個新的檔是前面兩種的組合。 但是,舊的檔已被否決,和目前仍工作,同時將停止在將來的版本中工作。 + +## 從 1.8.1 升級到 1.9.0 + +1. 刪除 `cordova-1.8.0.jar` 從專案的 `libs` 目錄。 + +2. 添加 `cordova-1.9.0.jar` 到專案中的 `libs` 目錄。 + +3. 如果您正在使用 Eclipse,請刷新您的 eclipse 專案,做清潔。 + +4. 複製新 `cordova-1.9.0.js` 到您的專案。 + +5. 更新您的 html 代碼,使用新的 `cordova-1.9.0.js` 檔。 + +6. 更新 `res/xml/plugins.xml` 以匹配`framework/res/xml/plugins.xml`. + +### 注意到關於 1.9.0 釋放 + +由於採用了 `CordovaWebView` ,協力廠商外掛程式可能無法正常工作。 這些外掛程式需要獲取上下文從 `CordovaInterface` 使用 `getContext()` 或 `getActivity()` 。 如果您不是一個經驗豐富的 Android 開發者,請聯繫外掛程式的維護者和將這項任務添加到其 bug 跟蹤工具。 + +## 從 1.8.0 升級到 1.8.0 + +1. 刪除 `cordova-1.8.0.jar` 從專案的 `libs` 目錄。 + +2. 添加 `cordova-1.8.1.jar` 到專案中的 `libs` 目錄。 + +3. 如果您正在使用 Eclipse,請刷新您的 eclipse 專案,做清潔。 + +4. 複製新 `cordova-1.8.1.js` 到您的專案。 + +5. 更新您的 html 代碼,使用新的 `cordova-1.8.1.js` 檔。 + +6. 更新 `res/xml/plugins.xml` 以匹配`framework/res/xml/plugins.xml`. + +## 從 1.7.0 升級到 1.8.0 + +1. 刪除 `cordova-1.7.0.jar` 從專案的 `libs` 目錄。 + +2. 添加 `cordova-1.8.0.jar` 到專案中的 `libs` 目錄。 + +3. 如果您正在使用 Eclipse,請刷新您的 eclipse 專案,做清潔。 + +4. 複製新 `cordova-1.8.0.js` 到您的專案。 + +5. 更新您的 html 代碼,使用新的 `cordova-1.8.0.js` 檔。 + +6. 更新 `res/xml/plugins.xml` 以匹配`framework/res/xml/plugins.xml`. + +## 從 1.7.0 升級到 1.8.0 + +1. 刪除 `cordova-1.7.0.jar` 從專案的 `libs` 目錄。 + +2. 添加 `cordova-1.8.0.jar` 到專案中的 `libs` 目錄。 + +3. 如果您正在使用 Eclipse,請刷新您的 eclipse 專案,做清潔。 + +4. 複製新 `cordova-1.8.0.js` 到您的專案。 + +5. 更新您的 html 代碼,使用新的 `cordova-1.8.0.js` 檔。 + +6. 更新 `res/xml/plugins.xml` 以匹配`framework/res/xml/plugins.xml`. + +## 從 1.6.1 升級到 1.7.0 + +1. 刪除 `cordova-1.6.1.jar` 從專案的 `libs` 目錄。 + +2. 添加 `cordova-1.7.0.jar` 到專案中的 `libs` 目錄。 + +3. 如果您正在使用 Eclipse,請刷新您的 eclipse 專案,做清潔。 + +4. 複製新 `cordova-1.7.0.js` 到您的專案。 + +5. 更新 `res/xml/plugins.xml` 以匹配`framework/res/xml/plugins.xml`. + +## 從 1.6.0 升級到 1.6.1 + +1. 刪除 `cordova-1.6.0.jar` 從專案的 `libs` 目錄。 + +2. 添加 `cordova-1.6.1.jar` 到專案中的 `libs` 目錄。 + +3. 如果您正在使用 Eclipse,請刷新您的 eclipse 專案,做清潔。 + +4. 複製新 `cordova-1.6.1.js` 到您的專案。 + +5. 更新 `res/xml/plugins.xml` 以匹配`framework/res/xml/plugins.xml`. + +## 從 1.5.0 版升級到 1.6.0 + +1. 刪除 `cordova-1.5.0.jar` 從專案的 `libs` 目錄。 + +2. 添加 `cordova-1.6.0.jar` 到專案中的 `libs` 目錄。 + +3. 如果您正在使用 Eclipse,請刷新您的 eclipse 專案,做清潔。 + +4. 複製新 `cordova-1.6.0.js` 到您的專案。 + +5. 更新您的 html 代碼,使用新的 `cordova-1.6.0.js` 檔。 + +6. 更新 `res/xml/plugins.xml` 以匹配`framework/res/xml/plugins.xml`. + +7. 替換 `res/xml/phonegap.xml` 與 `res/xml/cordova.xml` 進行匹配`framework/res/xml/cordova.xml`. + +## 從 1.4.0 升級到 1.5.0 版 + +1. 刪除 `phonegap-1.4.0.jar` 從專案的 `libs` 目錄。 + +2. 添加 `cordova-1.5.0.jar` 到專案中的 `libs` 目錄。 + +3. 如果您正在使用 Eclipse,請刷新您的 eclipse 專案,做清潔。 + +4. 複製新 `cordova-1.5.0.js` 到您的專案。 + +5. 更新您的 html 代碼,使用新的 `cordova-1.5.0.js` 檔。 + +6. 更新 `res/xml/plugins.xml` 以匹配`framework/res/xml/plugins.xml`. + +7. 替換 `res/xml/phonegap.xml` 與 `res/xml/cordova.xml` 進行匹配`framework/res/xml/cordova.xml`. + +## 從 1.3.0 升級到 1.4.0 + +1. 刪除 `phonegap-1.3.0.jar` 從專案的 `libs` 目錄。 + +2. 添加 `phonegap-1.4.0.jar` 到專案中的 `libs` 目錄。 + +3. 如果您正在使用 Eclipse,請刷新您的 eclipse 專案,做清潔。 + +4. 複製新 `phonegap-1.4.0.js` 到您的專案。 + +5. 更新您的 html 代碼,使用新的 `phonegap-1.4.0.js` 檔。 + +6. 更新 `res/xml/plugins.xml` 以匹配`framework/res/xml/plugins.xml`. + +7. 更新 `res/xml/phonegap.xml` 以匹配`framework/res/xml/phonegap.xml`. + +## 從 1.2.0 升級到 1.3.0 + +1. 刪除 `phonegap-1.2.0.jar` 從專案的 `libs` 目錄。 + +2. 添加 `phonegap-1.3.0.jar` 到專案中的 `libs` 目錄。 + +3. 如果您正在使用 Eclipse,請刷新您的 eclipse 專案,做清潔。 + +4. 複製新 `phonegap-1.3.0.js` 到您的專案。 + +5. 更新您的 html 代碼,使用新的 `phonegap-1.2.0.js` 檔。 + +6. 更新 `res/xml/plugins.xml` 以匹配`framework/res/xml/plugins.xml`. + +7. 更新 `res/xml/phonegap.xml` 以匹配`framework/res/xml/phonegap.xml`. + +## 從 1.1.0 升級到 1.2.0 + +1. 刪除 `phonegap-1.1.0.jar` 從專案的 `libs` 目錄。 + +2. 添加 `phonegap-1.2.0.jar` 到專案中的 `libs` 目錄。 + +3. 如果您正在使用 Eclipse,請刷新您的 eclipse 專案,做清潔。 + +4. 複製新 `phonegap-1.2.0.js` 到您的專案。 + +5. 更新您的 html 代碼,使用新的 `phonegap-1.2.0.js` 檔。 + +6. 更新 `res/xml/plugins.xml` 以匹配`framework/res/xml/plugins.xml`. + +7. 更新 `res/xml/phonegap.xml` 以匹配`framework/res/xml/phonegap.xml`. + +## 從 1.0.0 升級到 1.1.0 + +1. 刪除 `phonegap-1.0.0.jar` 從專案的 `libs` 目錄。 + +2. 添加 `phonegap-1.1.0.jar` 到專案中的 `libs` 目錄。 + +3. 如果您正在使用 Eclipse,請刷新您的 eclipse 專案,做清潔。 + +4. 複製新 `phonegap-1.1.0.js` 到您的專案。 + +5. 更新您的 html 代碼,使用新的 `phonegap-1.1.0.js` 檔。 + +6. 更新 `res/xml/plugins.xml` 以匹配`framework/res/xml/plugins.xml`. + +## 從 0.9.6 升級到 1.0.0 + +1. 刪除 `phonegap-0.9.6.jar` 從專案的 `libs` 目錄。 + +2. 添加 `phonegap-1.0.0.jar` 到專案中的 `libs` 目錄。 + +3. 如果您正在使用 Eclipse,請刷新您的 eclipse 專案,做清潔。 + +4. 複製新 `phonegap-1.0.0.js` 到您的專案。 + +5. 更新您的 html 代碼,使用新的 `phonegap-1.0.0.js` 檔。 + +6. 添加 `res/xml/plugins.xml` 以匹配`framework/res/xml/plugins.xml`. \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org For additional commands, e-mail: commits-help@cordova.apache.org