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 DFA6118F15 for ; Wed, 6 Apr 2016 09:27:17 +0000 (UTC) Received: (qmail 73994 invoked by uid 500); 6 Apr 2016 09:27:17 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 73920 invoked by uid 500); 6 Apr 2016 09:27:17 -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 73681 invoked by uid 99); 6 Apr 2016 09:27:17 -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:17 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 23271E0B49; Wed, 6 Apr 2016 09:27:17 +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:21 -0000 Message-Id: In-Reply-To: <0ea60741dd3e40f489f34a02f10641c5@git.apache.org> References: <0ea60741dd3e40f489f34a02f10641c5@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [05/51] [partial] docs commit: Adding both Chinese versions. http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/dev/guide/platforms/android/plugin.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/dev/guide/platforms/android/plugin.md b/www/docs/zh-cn/dev/guide/platforms/android/plugin.md new file mode 100644 index 0000000..8b341e6 --- /dev/null +++ b/www/docs/zh-cn/dev/guide/platforms/android/plugin.md @@ -0,0 +1,179 @@ +--- +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 平臺上實現本機外掛程式代碼的詳細資訊。 之前讀這篇文章,請參閱應用程式外掛程式外掛程式的結構和其共同的 JavaScript 介面的概述。 這一節繼續表明通信從科爾多瓦 web 視圖的本機平臺和後面的示例*回聲*外掛程式。 另一個示例,請參閱還在[CordovaPlugin.java][1]的評論. + + [1]: https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaPlugin.java + +Android 外掛程式基於科爾多瓦-Android,Android 的 web 視圖包括與附加到它上面的鉤子。 外掛程式被表示為類映射的 `config.xml` 檔。 外掛程式包括至少一個擴展的 JAVA 類的 `CordovaPlugin` 類,重寫的一個其 `execute` 方法。 作為最佳實踐,該外掛程式還應處理 `[pause](../../../cordova/events/events.pause.html)` 和 `[resume](../../../cordova/events/events.resume.html)` 事件,以及任何外掛程式之間傳遞的消息。 外掛程式需要長時間運行的請求,後臺活動媒體重播、 聽眾或內部狀態等應執行 `onReset()` ,以及方法。 它執行時 `WebView` 定位到新的一頁或刷新,重新載入 JavaScript。 + +## 外掛程式類映射 + +外掛程式的 JavaScript 介面使用 `cordova.exec` 方法,如下所示: + + exec (< successFunction > < failFunction >、 < 服務 >、 < 行動 > [< args >]) ; + + +這封送請求從 web 視圖到 Android 的本機對岸,有效地調用 `action` 方法 `service` 具有額外的參數中傳遞的類 `args` 陣列。 + +是否您分發外掛程式作為 JAVA 檔或作為它自己的一個*jar*檔,必須在科爾多瓦 Android 應用程式中指定外掛程式 `res/xml/config.xml` 檔。 有關如何使用的詳細資訊,請參閱應用程式外掛程式 `plugin.xml` 檔,把這個注射 `feature` 元素: + + + + + + +服務名稱匹配在 JavaScript 中使用 `exec` 調用。 值是 JAVA 類的完全限定命名空間識別碼。 否則為該外掛程式可能會編譯,但仍不能使用到科爾多瓦。 + +## 外掛程式初始化和存留期 + +外掛程式物件的一個實例創建為生活的每個 `WebView` 。 外掛程式不會具現化之前他們第一次引用通過調用從 JavaScript,除非 `` 與 `onload` `name` 屬性設置為 `"true"` 的 `config.xml` 。 例如: + + + + + + + +外掛程式應使用 `initialize` 方法為他們的創業邏輯。 + + @Override + public void initialize(CordovaInterface cordova, CordovaWebView webView) { + super.initialize(cordova, webView); + // your init code here + } + + +## 編寫一個 Android JAVA 外掛程式 + +JavaScript 調用觸發外掛程式請求到本機的一邊,和相應的 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"錯誤。 + } + + +JavaScript `exec` 函數的 `action` 參數對應于一個類的私有類方法派遣了可選參數。 + +當捕獲異常,並返回錯誤,重要的是為了明確起見,錯誤返回給 JavaScript 匹配 JAVA 異常名稱盡可能多。 + +## 執行緒 + +外掛程式的 JavaScript 並*不*在主執行緒中運行 `WebView` 介面 ; 相反,它會運行 `WebCore` 執行緒,一樣 `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; + } + + +使用以下如果你不需要在主介面上運行的執行緒,但不是想阻止 `WebCore` 執行緒或者: + + @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 外掛程式示例 + +若要匹配的 JavaScript 介面*回波*特徵描述的應用程式外掛程式,使用 `plugin.xml` 來注入 `feature` 到本地平臺規範 `config.xml` 檔: + + + + + + + + + + +然後添加以下到 `src/org/apache/cordova/plugin/Echo.java` 檔: + + 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."); + } + } + } + + +必要的進口商品在檔的頂部延伸中的類 `CordovaPlugin` ,其 `execute()` 方法,它將覆蓋從其接收郵件 `exec()` 。 `execute()`方法第一次測試的值 `action` ,在這種情況下有有效期的只有一個 `echo` 的值。 任何其他行動返回 `false` ,並導致 `INVALID_ACTION` 錯誤,會轉換為調用的 JavaScript 一邊錯誤回檔。 + +下一步,該方法檢索 echo 字串使用 `args` 物件的 `getString` 方法,指定的第一個參數傳遞給該方法。 值傳遞給一個私人後 `echo` 的方法,它是參數檢查,以確保它不是 `null` 或空字串,這種情況下的 `callbackContext.error()` 調用 JavaScript 的錯誤回檔。 如果通過各種檢查, `callbackContext.success()` 將傳遞原始 `message` 回 JavaScript 的成功回檔作為參數的字串。 + +## Android 系統集成 + +Android 功能 `Intent` 允許進程互相溝通的系統。 外掛程式可以訪問 `CordovaInterface` 物件,可以訪問 Android `Activity` ,運行應用程式。 這是 `Context` 啟動新的 android 系統所需 `Intent` 。 `CordovaInterface`允許外掛程式啟動 `Activity` 一個結果,並設置回檔外掛程式時 `Intent` 返回到應用程式。 + +到科爾多瓦 2.0 外掛程式可以不再直接存取 `Context` ,和遺產 `ctx` 成員已被否決。 所有 `ctx` 的方法上存在 `Context` ,所以這兩個 `getContext()` 和 `getActivity()` 可以返回所需的物件。 + +## 調試 Android 外掛程式 + +Eclipse 允許您調試外掛程式作為 JAVA 原始程式碼包含在專案中。 只有最新版本的 Android 開發者工具允許您將原始程式碼附加到*JAR*的依賴關係,所以此功能尚不完全支援。 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/dev/guide/platforms/android/tools.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/dev/guide/platforms/android/tools.md b/www/docs/zh-cn/dev/guide/platforms/android/tools.md new file mode 100644 index 0000000..b1fdbba --- /dev/null +++ b/www/docs/zh-cn/dev/guide/platforms/android/tools.md @@ -0,0 +1,205 @@ +--- +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 應用程式。 這種發展道路,概述中討論可能會為您提供比所述的命令列介面的跨平臺 CLI 工具更大範圍的發展方案。 例如,您需要部署一個科爾多瓦 web 視圖自訂旁邊的本機組件時使用外殼程式工具。 在使用之前要麼發展路徑,您必須首先配置 Android SDK 環境 Android 平臺指南中所述。 + +要為 android 系統啟用外殼工具,請從[cordova.apache.org][1]下載科爾多瓦。 下載檔案中包含單獨的檔案,為每個平臺。 展開每個您想要的目標, `android` 在這種情況下。 相關的工具,通常可用在頂級 `bin` 目錄中,否則為諮詢**自述**檔,瞭解有關更多詳細的指示。 + + [1]: http://cordova.apache.org + +這些工具允許您創建、 構建和運行 Android 應用程式。 額外的命令列介面,可以跨所有平臺的外掛程式功能的資訊,請參閱使用 Plugman 到管理外掛程式。 有關如何開發外掛程式的詳細資訊,請參閱應用程式外掛程式。 + +## 創建一個專案 + +運行 `create` 命令,指定的現有路徑的專案、 反向域風格包識別碼和應用程式的顯示名稱。 這裡是 Mac/Linux 和 Windows 的語法: + + $ /path/to/cordova-android/bin/create /path/to/project com.example.project_name ProjectName + + C:\>\path\to\cordova-android\bin\create.bat \path\to\project com.example.project_name ProjectName + + +## 生成 + +此清理,然後生成專案。 + +在 Mac/Linux 或 Windows 上調試: + + $ /path/to/project/cordova/build --debug + + C:\>\path\to\project\cordova\build.bat --debug + + +釋放,Mac/Linux 或 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 [Target] [Build] + + C:\>\path\to\project\cordova\run.bat [Target] [Build] + + +請確保您創建至少一個 Android 虛擬裝置,否則為系統會提示您這樣與做 `android` 命令。 如果多個 AVD 可用作為目標,提示您選擇一個。 預設情況下 `run` 命令檢測連接的設備或當前正在運行的模擬程式,如果沒有設備發現。 + +## 簽署應用程式 + +您可以查看簽名要求在這裡的安卓應用程式: HTTP://developer.android.com/tools/publishing/app-signing.html + +要簽名的應用程式,您需要以下參數: + +* 金鑰庫 (`--keystore`): 可容納一套鑰匙的二進位檔案的路徑。 + +* 金鑰庫口令 (`-storePassword`): 到金鑰庫的密碼 + +* 別名 (`--alias`): 指定私密金鑰用於唱歌的 id。 + +* * 密碼 (`--password`): 為指定的私密金鑰的密碼。 + +* 金鑰庫 (`--keystoreType`) 類型: pkcs12 jks (預設: 自動檢測基於檔副檔名) + +可以使用`build`或`run`腳本上面的命令列參數指定這些參數。 + +或者,您可以指定它們在組建組態檔 (build.json) 中使用 ( `--buildConfig` ) 參數。這裡是組建組態檔的一個示例: + + { + "android": { + "debug": { + "keystore": "..\android.keystore", + "storePassword": "android", + "alias": "mykey1", + "password" : "password", + "keystoreType": "" + }, + "release": { + "keystore": "..\android.keystore", + "storePassword": "", + "alias": "mykey2", + "password" : "password", + "keystoreType": "" + } + } + } + + +對於發佈簽名,可以排除密碼和構建系統會發出提示要求輸入密碼。 + +此外,它還支援以混合和匹配的命令列參數和 build.json 檔中的參數。 從命令列參數的值將會得到優先。 這可用於在命令列上指定的密碼。 + +## 日誌記錄 + + $ /path/to/project/cordova/log + + C:\>\path\to\project\cordova\log.bat + + +## 清洗 + + $ /path/to/project/cordova/clean + + C:\>\path\to\project\cordova\clean.bat + + +## Gradle 建築 + +截至 cordova-android@4.0.0,專案生成使用[Gradle][2]。 關於建設與螞蟻的說明,請參閱文檔的舊版本。 + + [2]: http://www.gradle.org/ + +### Gradle 屬性 + +可以設置這些[屬性][3]以自訂生成: + + [3]: http://www.gradle.org/docs/current/userguide/tutorial_this_and_that.html + +* **cdvBuildMultipleApks**(預設: false) + + 如果設置此值,則將生成多個 APK 檔: 庫專案所支援的本機平臺每一個 (x 86,ARM,等)。 這可能是重要的如果您的專案使用大型的本機庫,可以大幅增加生成 apk 檔的大小。 + + 如果未設置,然後將生成單個 APK,可以在所有設備上使用。 + +* **cdvVersionCode** + + VersionCode 在`AndroidManifest.xml`中設置將重寫 + +* **cdvReleaseSigningPropertiesFile**(預設: release-signing.properties) + + 包含簽名發佈的資訊進行.properties 檔路徑生成。 該檔應該看起來像: + + storeFile=relative/path/to/keystore.p12 + storePassword=SECRET1 + storeType=pkcs12 + keyAlias=DebugSigningKey + keyPassword=SECRET2 + + + `storePassword`和`keyPassword`是可選的如果省略將提示輸入。 + +* **cdvDebugSigningPropertiesFile**(預設: debug-signing.properties) + + 同樣作為 cdvReleaseSigningPropertiesFile,但用於調試生成。當您需要與其他開發人員共用的簽名金鑰時有用。 + +* **cdvMinSdkVersion** + + 重寫`minSdkVersion`在`AndroidManifest.xml`中設置的值。有用的當創建多個 APKs 基於 SDK 版本。 + +* **cdvBuildToolsVersion** + + 重寫自動檢測到的`android.buildToolsVersion`值。 + +* **cdvCompileSdkVersion** + + 重寫自動檢測到的`android.compileSdkVersion`值。 + +### 擴展 build.gradle + +如果您需要自訂`build.gradle`,而不是直接編輯,您應該創建一個名為`build-extras.gradle`的同級檔。 此檔將包含由主要的`build.gradle`時本。 下面是一個示例: + + # Example build-extras.gradle + # This file is included at the beginning of `build.gradle` + ext.cdvDebugSigningPropertiesFile = '../../android-debug-keys.properties' + # When set, this function allows code to run at the end of `build.gradle` + ext.postBuildExtras = { + android.buildTypes.debug.applicationIdSuffix = '.debug' + } + + +請注意,外掛程式也可以包括通過`build-extras.gradle`檔: + + + + +### 示例生成 + + export ORG_GRADLE_PROJECT_cdvMinSdkVersion=14 + cordova build android -- --gradleArg=-PcdvBuildMultipleApks=true \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/dev/guide/platforms/android/upgrade.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/dev/guide/platforms/android/upgrade.md b/www/docs/zh-cn/dev/guide/platforms/android/upgrade.md new file mode 100644 index 0000000..12a1d12 --- /dev/null +++ b/www/docs/zh-cn/dev/guide/platforms/android/upgrade.md @@ -0,0 +1,500 @@ +--- +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 版本。 + +## 升級到 4.0.0 + +有利用 4.0.0 的重大變化所需的特定升級步驟。第一,常見的升級步驟,如下所示。 + +對於非 CLI 專案,運行: + + bin/update path/to/project + + +對於 CLI 專案: + +1. 更新 `cordova` CLI 版本。請參閱命令列介面。 + +2. 在你現有的專案中運行 `cordova platform update android`。 + +### 升級白名單 + +現在通過外掛程式實現所有的白名單功能。 無外掛程式升級到 4.0.0 後您的應用程式不再卻是白名單的保護。科爾多瓦有兩個白名單外掛程式,提供不同的保護層級。 + +1. `cordova-plugin-whitelist` 外掛程式 *(推薦)* + + * 這個外掛程式被推薦的是更加安全和可配置比在以前的版本中白 + * 在所需的配置更改上看到 [cordova-plugin-whitelist][1] 的詳細資訊 + * 兼營: `cordova plugin add cordova-plugin-crosswalk-webview` + +2. `cordova-plugin-legacy-whitelist` 外掛程式 + + * 這個外掛程式提供了相同的白名單中行為,作為以前的版本。請參閱 [cordova-plugin-legacy-whitelist][2] + * 沒有配置更改是必需的但它提供了比推薦外掛程式的保護較少 + * 兼營: `cordova-plugin-legacy-whitelist` + + [1]: https://github.com/apache/cordova-plugin-whitelist + [2]: https://github.com/apache/cordova-plugin-legacy-whitelist + +### 使用人行橫道上 web 視圖 + +預設情況下,您的應用程式將繼續使用 web 視圖提供的設備的系統。如果你想要改用人行橫道上 web 視圖,只需添加人行橫道上的外掛程式: + + cordova plugin add cordova-plugin-crosswalk-webview + + +後添加的外掛程式,您的應用程式會得到人行橫道上 web 視圖正確安裝和配置。 + +### 升級到閃屏外掛程式 + +如果您的應用程式使用一個閃屏功能已被轉移到一個外掛程式。 用於初始螢幕的配置選項是不變的。 所需的只有升級步驟是要添加的外掛程式: + + cordova plugin add cordova-plugin-splashscreen + + +## 從 3.6.0 版升級到 3.7.1 + +對於非 CLI 專案,運行: + + bin/update path/to/project + + +對於 CLI 專案: + +1. 更新 `cordova` CLI 版本。請參閱命令列介面。 + +2. 運行 `cordova platform update android` 在你現有的專案中。 + +## 從 3.2.0 升級到 3.3.0 + +按照關於 `3.2.0` 相同的說明. + +入手 3.3.0,科爾多瓦運行時現在被編譯為 Android 的庫,而不是一個罐子裡。 這都不應該影響為命令列用法,但 IDE 使用者將需要新增的 `MyProject CordovaLib` 專案導入到他們的工作區。 + +## 從 3.1.0 升級到 3.2.0 + +為專案創建的科爾多瓦 CLI: + +1. 更新 `cordova` CLI 版本。請參閱命令列介面。 + +2. 運行 `cordova platform update android` + +不創建與科爾多瓦 CLI 的專案,請運行: + + bin/update + + +**警告:**關於 Android 4.4-Android 4.4.3,創建檔輸入具有類型的元素 ="檔"將不會打開檔選取器對話方塊。 這是鉻對 Android 的回歸和能重現該問題在 Android 上獨立 Chrome 瀏覽器 (見 HTTP://code.google.com/p/android/issues/detail?id=62220) 建議的解決方法是使用的檔案傳輸和檔的外掛程式為 Android 4.4。您可以偵聽 onClick 事件從輸入類型 ="檔",然後彈出一個檔選擇器 UI。 為了打領帶表單資料的上傳,你可以使用 JavaScript 將表單值附加到多個部分的 POST 請求所使。 + +## 從 3.0.0 升級到 3.1.0 + +為專案創建的科爾多瓦 CLI: + +1. 更新 `cordova` CLI 版本。請參閱命令列介面。 + +2. 運行 `cordova platform update android` + +不創建與科爾多瓦 CLI 的專案,請運行: + + bin/update + + +## 從 2.9.0 升級到 CLI (3.0.0) + +1. 創建一個新的 Apache 科爾多瓦 3.0.0 專案使用 CLI,科爾多瓦在命令列介面所述。 + +2. 添加您的平臺的科爾多瓦的專案,例如: `cordova platform add android`. + +3. 將您的專案 `www` 目錄中的內容複寫到您剛剛創建的科爾多瓦專案根本 `www` 目錄。 + +4. 將本機的任何資產從舊專案複製到相應的目錄下 `平臺/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. 從專案的 `libs` 目錄刪除 `cordova-2.7.0.jar`。 + +2. 將 `cordova-2.8.0.jar` 添加到專案的 `libs` 目錄。 + +3. 如果您使用 Eclipse,請刷新您的 Eclipse 專案,做清潔。 + + + +1. 將新的 `cordova.js` 複製到您的專案。 + +2. 更新你的 html 代碼,使用新的 `cordova.js` 檔。 + +3. 要匹配 `framework/res/xml/config.xml` 的 `res/xml/config.xml` 檔的副本. + +4. 更新 `framework/res/xml/config.xml` 以前一樣有類似的設置。 + +5. 將檔從複製 `bin/templates/cordova` 到專案的 `cordova` 目錄。 + +## 從 2.6.0 升級到 2.7.0 + +1. 從專案的 `libs` 目錄刪除 `cordova-2.6.0.jar`。 + +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. 從專案的 `libs` 目錄刪除 `cordova-2.5.0.jar`。 + +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. 從專案的 `libs` 目錄刪除 `cordova-2.4.0.jar`。 + +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. 從專案的 `libs` 目錄刪除 `cordova-2.3.0.jar`。 + +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. 從專案的 `libs` 目錄刪除 `cordova-2.2.0.jar`。 + +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. 從專案的 `libs` 目錄刪除 `cordova-2.1.0.jar`。 + +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. 從專案的 `libs` 目錄刪除 `cordova-2.0.0.jar`。 + +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. 從專案的 `libs` 目錄刪除 `cordova-1.9.0.jar`。 + +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`。 舊的檔已被否決,和當他們仍然在 2.0.0,工作就會停止工作在將來的版本中。 + +## 從 1.8.1 升級到 1.9.0 + +1. 從專案的 `libs` 目錄刪除 `cordova-1.8.0.jar`。 + +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`. + +由於引入了 `CordovaWebView` 在 1.9.0 釋放,協力廠商外掛程式可能無法工作。 這些外掛程式需要從 `CordovaInterface` 使用 `getContext()` 或 `getActivity()` 獲取上下文。 如果你不是一個經驗豐富的 Android 開發者,請聯繫外掛程式的維護者,並將該任務添加到其 bug 追蹤器。 + +## 從 1.8.0 升級到 1.8.0 + +1. 從專案的 `libs` 目錄刪除 `cordova-1.8.0.jar`。 + +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. 從專案的 `libs` 目錄刪除 `cordova-1.7.0.jar`。 + +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. 從專案的 `libs` 目錄刪除 `cordova-1.7.0.jar`。 + +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. 從專案的 `libs` 目錄刪除 `cordova-1.6.1.jar`。 + +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. 從專案的 `libs` 目錄刪除 `cordova-1.6.0.jar`。 + +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. 從專案的 `libs` 目錄刪除 `cordova-1.5.0.jar`。 + +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/cordova.xml` 以匹配 `framework/res/xml/cordova.xml` `res/xml/phonegap.xml`. + +## 從 1.4.0 升級到 1.5.0 版 + +1. 從專案的 `libs` 目錄刪除 `phonegap-1.4.0.jar`。 + +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/cordova.xml` 以匹配 `framework/res/xml/cordova.xml` `res/xml/phonegap.xml`. + +## 從 1.3.0 升級到 1.4.0 + +1. 從專案的 `libs` 目錄刪除 `phonegap-1.3.0.jar`。 + +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. 從專案的 `libs` 目錄刪除 `phonegap-1.2.0.jar`。 + +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.2.0 從 1.1.0 + +1. 從專案的 `libs` 目錄刪除 `phonegap-1.1.0.jar`。 + +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. 從專案的 `libs` 目錄刪除 `phonegap-1.0.0.jar`。 + +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. 從專案的 `libs` 目錄刪除 `phonegap-0.9.6.jar`。 + +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 http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/dev/guide/platforms/android/upgrading.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/dev/guide/platforms/android/upgrading.md b/www/docs/zh-cn/dev/guide/platforms/android/upgrading.md new file mode 100644 index 0000000..335a4b5 --- /dev/null +++ b/www/docs/zh-cn/dev/guide/platforms/android/upgrading.md @@ -0,0 +1,436 @@ +--- +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.2.0 升級到 3.3.0 + +遵循相同的 instructinos`3.2.0`. + +從 3.3.0 開始,科爾多瓦運行時是現在作為編譯 Android 的庫,而不是 Jar。 這都不應該影響對於命令列用法,但 IDE 使用者將需要導入到新添加的 `MyProject-CordovaLib` 到其工作區中的專案。 + +## 從 3.1.0 升級到 3.2.0 + +為創建的科爾多瓦 CLI 的專案: + +1. 更新 `cordova` CLI 版本。請參閱命令列介面。 + +2. 運行`cordova platform update android` + +對於不使用 CLI 科爾多瓦創建的專案,請運行: + + bin/update + + +## 從 3.0.0 升級到 3.1.0 + +為創建的科爾多瓦 CLI 的專案: + +1. 更新 `cordova` CLI 版本。請參閱命令列介面。 + +2. 運行`cordova platform update android` + +對於不使用 CLI 科爾多瓦創建的專案,請運行: + + bin/update + + +## 從 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 專案,做清潔。 + + + +1. 複製新 `cordova.js` 到您的專案。 + +2. 更新您的 html 代碼,使用新的 `cordova.js` 檔。 + +3. 複製 `res/xml/config.xml` 檔,以匹配`framework/res/xml/config.xml`. + +4. 更新 `framework/res/xml/config.xml` 以前一樣有類似的設置。 + +5. 將檔從複製 `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` 。 舊的檔已被否決,,雖然他們仍工作在 2.0.0,將停止在將來的版本中工作。 + +## 從 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`. + +由於採用了 `CordovaWebView` 的 1.9.0 版本中,協力廠商外掛程式可能無法工作。 這些外掛程式需要獲取上下文從 `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 http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/dev/guide/platforms/android/webview.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/dev/guide/platforms/android/webview.md b/www/docs/zh-cn/dev/guide/platforms/android/webview.md new file mode 100644 index 0000000..9d51f46 --- /dev/null +++ b/www/docs/zh-cn/dev/guide/platforms/android/webview.md @@ -0,0 +1,116 @@ +--- +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 WebViews +--- + +# Android WebViews + +本指南說明如何將嵌入在較大型的 Android 應用程式內的科爾多瓦啟用 web 視圖元件。這些元件可以如何與對方溝通的詳細資訊,請參閱應用程式外掛程式。 + +如果你熟悉 Android,你應首先熟悉 Android 平臺指南和之前你嘗試更不尋常發展嵌入 web 視圖的選項,安裝了最新 Android sdk。 從開始科爾多瓦 1.9,Android 平臺依靠 `CordovaWebView` 元件,生成遺留下來 `CordovaActivity` 預日期 1.9 版本的元件。 + +1. 要按照這些說明進行操作,請確保您有最新的科爾多瓦分佈。從[cordova.apache.org][1]下載和解壓縮其 android 系統的套裝軟體。 + +2. 導航到 Android 包 `/framework` 目錄並運行 `ant jar` 。它創建了科爾多瓦 `.jar` 檔中,形成了作為`/framework/cordova-x.x.x.jar`. + +3. 複製 `.jar` 到 Android 專案檔案 `/libs` 目錄。 + +4. 將以下內容添加到應用程式的 `/res/xml/main.xml` 檔中,與 `layout_height` 、 `layout_width` 和 `id` 修改,以適合應用程式: + + + + +5. 修改活動,使它實現了 `CordovaInterface` 。 它應實施的包括的方法。 您可能希望將它們從複製 `/framework/src/org/apache/cordova/CordovaActivity.java` ,或其他執行他們自己。 下面的代碼片段顯示了一個基本的應用程式依賴于介面。 請注意如何引用的視圖 id 匹配 `id` 在上面所示的 XML 片段中指定的屬性: + + public class CordovaViewTestActivity extends Activity implements CordovaInterface { + CordovaWebView cwv; + /* Called when the activity is first created. */ + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.main); + cwv = (CordovaWebView) findViewById(R.id.tutorialView); + Config.init(this); + cwv.loadUrl(Config.getStartUrl()); + } + + +6. 如果應用程式需要使用相機,實現以下內容: + + @Override + public void setActivityResultCallback(CordovaPlugin plugin) { + this.activityResultCallback = plugin; + } + /** + * Launch an activity for which you would like a result when it finished. When this activity exits, + * your onActivityResult() method is called. + * + * @param command The command object + * @param intent The intent to start + * @param requestCode The request code that is passed to callback to identify the activity + */ + public void startActivityForResult(CordovaPlugin command, Intent intent, int requestCode) { + this.activityResultCallback = command; + this.activityResultKeepRunning = this.keepRunning; + + // If multitasking turned on, then disable it for activities that return results + if (command != null) { + this.keepRunning = false; + } + + // Start activity + super.startActivityForResult(intent, requestCode); + } + + @Override + /** + * Called when an activity you launched exits, giving you the requestCode you started it with, + * the resultCode it returned, and any additional data from it. + * + * @param requestCode The request code originally supplied to startActivityForResult(), + * allowing you to identify who this result came from. + * @param resultCode The integer result code returned by the child activity through its setResult(). + * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). + */ + protected void onActivityResult(int requestCode, int resultCode, Intent intent) { + super.onActivityResult(requestCode, resultCode, intent); + CordovaPlugin callback = this.activityResultCallback; + if (callback != null) { + callback.onActivityResult(requestCode, resultCode, intent); + } + } + + +7. 最後,請記住,添加執行緒池,否則外掛程式有沒有線程在其上運行: + + @Override + public ExecutorService getThreadPool() { + return threadPool; + } + + +8. 將應用程式的 HTML 和 JavaScript 檔案複製到 Android 專案 `/assets/www` 目錄。 + +9. 複製 `config.xml` 檔從 `/framework/res/xml` 到專案中的 `/res/xml` 目錄。 + + [1]: http://cordova.apache.org \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/dev/guide/platforms/blackberry/config.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/dev/guide/platforms/blackberry/config.md b/www/docs/zh-cn/dev/guide/platforms/blackberry/config.md new file mode 100644 index 0000000..b66e781 --- /dev/null +++ b/www/docs/zh-cn/dev/guide/platforms/blackberry/config.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: 黑莓手機配置 +--- + +# 黑莓手機配置 + +黑莓手機完全支援[W3C 構件規範][1]以及專有的 RIM 擴展。 請全面[黑莓 WebWorks 檔關於 config.xml][2]的詳細資訊,參閱。 + + [1]: http://www.w3.org/TR/widgets/ + [2]: https://developer.blackberry.com/html5/documentation/working_with_config_xml_file_1866970_11.html \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/dev/guide/platforms/blackberry/index.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/dev/guide/platforms/blackberry/index.md b/www/docs/zh-cn/dev/guide/platforms/blackberry/index.md new file mode 100644 index 0000000..5519e8b --- /dev/null +++ b/www/docs/zh-cn/dev/guide/platforms/blackberry/index.md @@ -0,0 +1,164 @@ +--- +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: 黑莓平臺指南 +--- + +# 黑莓平臺指南 + +本指南介紹了如何設置用於目標應用程式的版本 10 之前的黑莓平臺 SDK 環境。 如果你想要的目標的最新版本,請參閱黑莓 10 平臺指南。 請參閱下列特定于平臺的詳細資訊: + +* [黑莓手機配置](config.html) +* [升級黑莓手機](upgrading.html) +* [黑莓手機的外掛程式](plugin.html) +* [黑莓手機的命令列工具](tools.html) + +上面的命令列工具請參閱科爾多瓦 3.0 以前的版本。關於當前介面的資訊,請參閱命令列介面。 + +## 要求和支援 + +此版本的黑莓手機不支援由 `cordova` 所述的命令列介面,而是由一組單獨的命令列工具的實用程式。 從[cordova.apache.org][1]下載的科爾多瓦分佈. + + [1]: http://cordova.apache.org/#download + +科爾多瓦的黑莓手機依賴于[黑莓 WebWorks 框架][2],這是可用於 Windows XP (32 位),Windows 7 (32 位和 64 位) 和 Mac (OS X 10.6.4+)。 WebWorks 應用程式可以*只*在以下黑莓平臺上部署: + + [2]: https://bdsc.webapps.blackberry.com/html5 + +* 黑莓 OS 5.0 和更高 +* 黑莓 PlayBook +* 黑莓 10 (QNX) + +WebWorks 需要 JAVA 開發工具組 (JDK)。 對於 Windows,使用 32 位版本的[Oracle JDK][3]。 JAVA 中的預設安裝的 Mac OS X 上最新支援版本 10.7,這需要[單獨安裝][4]。 它還要求 Apache Ant 在 Mac 上是 JAVA 安裝的一部分安裝。 Windows 版本,從[ant.apache.org][5]. + + [3]: http://www.oracle.com/technetwork/java/javase/downloads/index.html#jdk + [4]: http://support.apple.com/kb/DL1421 + [5]: http://ant.apache.org/bindownload.cgi + +## 安裝 SDK + +下載並安裝適當的 WebWorks SDK,為您的發展。可以從以下位置下載黑莓 PlayBook 和黑莓智慧手機 WebWorks Sdk。 + +* \[黑莓 PlayBook SDK\](HTTPs://developer.blackberry.com/html5/download/#playbook) 和[Adobe Air SDK][6] + +* \[黑莓智慧手機 SDK\]() HTTPs://developer.blackberry.com/html5/download/#smartphones + + [6]: http://www.adobe.com/devnet/air/air-sdk-download.html + +## 登記冊的簽名金鑰 + +如果您希望發佈黑莓應用程式商店上的應用程式或在實際設備上,您會需要註冊一套免費的代碼簽名金鑰。 要這樣做,請完成[黑莓鍵訂單表單][7]。 一旦您收到你簽署的鑰匙,他們需要進行設置。 請參閱[黑莓 HTML5/WebWorks 網站][8]的資訊。 + + [7]: https://www.blackberry.com/SignedKeys + [8]: https://developer.blackberry.com/html5/documentation/signing_setup_bb10_apps_2008396_11.html + +## 安裝科爾多瓦 + +下載並解壓縮[科爾多瓦][1]的最新副本. + +## 設立了一個新的專案 + +* 打開一個命令列終端並導航到您解壓縮科爾多瓦。 + +* 那裡是科爾多瓦支援每個平臺的目錄。導航到 `blackberry` 目錄。 + +* `blackberry`目錄中包含幾個子目錄。 `example`目錄中包含一個完整的科爾多瓦專案。 複製 `example` 目錄到您的電腦上的另一個位置和導航到那裡。 + +* 編輯 `project.properties` 檔,以指定您使用的 WebWorks SDK。 例如,下面是黑莓 PlayBook,黑莓智慧手機 (OS5-7) 或黑莓 10 (QNX) 的各自設置: + + playbook.bbwp.dir=C:\\Program Motion\\BlackBerry WebWorks SDK 中 Files\\Research 為 TabletOS 2.1.0.6\\bbwp blackberry.bbwp.dir=C:\\Program Motion\\BlackBerry WebWorks Packager 在 Files\\Research qnx.bbwp.dir=C:\\Program 檔 (86) \\Research In Motion\\BlackBerry 10 WebWorks SDK 1.0.2.9 + + +這些參數對應于參數指定在生成您的專案時。首次運行這些命令,它們生成一個"HelloWorld"應用程式: + + 科爾多瓦/生成 playbook 科爾多瓦/生成黑莓科爾多瓦/生成 qnx + + +和 SDK,您還需要註冊的代碼簽名金鑰和調試標記。 簽名金鑰允許您分發通過黑莓應用程式。 調試標記使您可以測試黑莓手機模擬器或設備上未簽名的應用程式。 您不需要創建和安裝調試標記自己 ;如果你提供的金鑰庫的密碼,生成腳本創建,並為您安裝調試標記。 若要設置簽名金鑰,請轉到黑莓手機網站來得到它,確保保留您指定的密碼。 然後運行 `blackberry-signer` 實用套裝程式含的 SDK。 黑莓手機提供了更多的資訊在這裡: + +* [註冊您的代碼簽名金鑰][9] + +* [設置您的電腦代碼簽名][10] + +* [設置您的 SDK 環境的綜合指南][11] + + [9]: https://www.blackberry.com/SignedKeys/codesigning.html + [10]: http://developer.blackberry.com/html5/documentation/set_up_for_signing.html + [11]: http://developer.blackberry.com/native/documentation/bb10/com.qnx.doc.native_sdk.quickstart/topic/set_up_your_environment.html + +## 部署到模擬程式 + +在 Windows 上,黑莓智慧手機模擬器,才可用。 黑莓 PlayBook 模擬器需要 VMWare 播放機 (Windows) 或 VMWare 融合 (Mac OS X)。 WebWorks SDK 提供了一個預設模擬器,但額外的模擬程式都[可以通過黑莓手機][12]. + + [12]: http://us.blackberry.com/developers/resources/simulators.jsp + +從專案目錄中,鍵入 `./cordova/run ` ,更換 `` 或 `qnx` , `playbook` ,或 `blackberry` 。 請注意對於黑莓 10 和行動手冊,必須已經啟動模擬程式虛擬映射。 + +請參閱下列內容的詳細資訊: + +* [黑莓 PlayBook][13] + +* [黑莓智慧手機][14] + + [13]: https://developer.blackberry.com/html5/documentation/using_the_tablet_simulator_1866980_11.html + [14]: https://developer.blackberry.com/html5/documentation/run_your_app_on_smartphone_sim_1876976_11.html + +對於黑莓 Playbook 編輯 `project.properties` 檔以自訂 `playbook.sim.ip` 和 `playbook.sim.password` 的屬性。 可通過**設置**應用程式主畫面上模擬程式的 IP 位址。 啟用**的安全和隱私 → 發展模式**選項,以顯示該位址。 此外可以在**安全和隱私**選項卡中設置密碼。 + +對於黑莓智慧手機,編輯 `project.properties` 檔以自訂 `blackberry.sim.dir` 和 `blackberry.sim.bin` 的屬性。 您需要在 Windows 上,例如指定目錄路徑時逃脫的路徑分隔符號:`C:\\Program +Files\\BlackBerry\\Simulator`. + +一旦該模擬程式已安裝並運行,運行任一以下操作以安裝到主畫面的應用程式: + + 科爾多瓦/運行 playbook 科爾多瓦/運行黑莓 + + +如果設備連接到您的電腦是否提示您時,回答否。 + +**注:**上黑莓 OS 5,該應用程式安裝在 `Downloads` 目錄。 + +## 將部署到設備 + +要將您的應用程式部署到一個設備,它必須連接,和您必須註冊為代碼簽名金鑰,如上文所述。 也、 要部署應用程式對黑莓 PlayBook**設置 → 安全 → 發展模式**必須啟用選項。 + +在黑莓 PlayBook 上編輯 `project.properties` 檔和修改以下以反映該設備的 IP 和密碼作為配置上面,一直以來與您設置的簽名私密金鑰密碼: + +從專案目錄中,鍵入 `./cordova/run ` ,更換 `` 或 `qnx` , `playbook` ,或`blackberry`. + +在黑莓智慧手機 (OS5-7),指定 `blackberry.sigtool.password` 屬性作為簽名的私密金鑰密碼。 + +然後從該專案的目錄,運行你會在模擬程式中查看該應用程式的命令之一: + + 科爾多瓦/運行 playbook 科爾多瓦/運行黑莓 + + +如果設備連接到您的電腦是否提示您時,回答是。 + +**注:**上黑莓 OS 5,該應用程式安裝在 `Downloads` 目錄。 + +## 附加資訊 + +下面的文章可能説明您解決常見的問題,開發的黑莓 WebWorks 框架生成的應用程式時: + +* [黑莓 WebWorks 發展陷阱][15] + +* [包裝 WebWorks 應用程式的最佳做法][16] + + [15]: http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Common-BlackBerry-WebWorks-development-pitfalls-that-can-be/ta-p/624712 + [16]: https://bdsc.webapps.blackberrycom/html5/documentation/ww_developing/bestpractice_compiling_ww_apps_1873324_11.html \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/dev/guide/platforms/blackberry/plugin.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/dev/guide/platforms/blackberry/plugin.md b/www/docs/zh-cn/dev/guide/platforms/blackberry/plugin.md new file mode 100644 index 0000000..75f813c --- /dev/null +++ b/www/docs/zh-cn/dev/guide/platforms/blackberry/plugin.md @@ -0,0 +1,108 @@ +--- +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: 黑莓手機的外掛程式 +--- + +# 黑莓手機的外掛程式 + +本指南介紹了如何開發回聲外掛程式在黑莓手機上。 外掛程式開發指南提供廣泛概述,你應該已經是熟悉的和本指南撿起它的留下。 此外,下載[科爾多瓦黑莓手機存儲庫][1]. + + [1]: https://git-wip-us.apache.org/repos/asf?p=cordova-blackberry-webworks.git;a=summary + +`Cordova-BlackBerry`專案允許您將部署到黑莓火炬、 加粗和操作手冊等。 Playbook 使用不同的代碼基比其他黑莓手持設備,您需要為其重複你的發展努力。 本指南著重于手持設備,而不是平板電腦。 (在將來,本指南應包括這兩個平臺)。 + +Echo 外掛程式基本上是返回使用者不管消息提供給 `window.echo` 函數: + + window.echo = function(str, callback) { + cordova.exec(callback, function(err) { + callback('Nothing to echo.'); + }, "Echo", "echo", [str]); + }; + + +## 修改 plugins.xml + +您的專案的 `www/plugins.xml` 目錄中包含的所有必要引用到科爾多瓦專案的外掛程式。 添加一個額外的引用,這樣,當 `cordova.exec` 是科爾多瓦叫,知道如何映射 `Echo` 參數的 `cordova.exec` 到 `Echo` 我們想要寫本機的類: + + + + + + +## 添加 Echo.java + +如果您注意到結構的值屬性,您將看到已定義的路徑,導致回聲外掛程式。 在科爾多瓦黑莓 WebWorks 回購的根目錄中,查找名為的目錄 `framework` 。 此目錄包含所有的原始程式碼在黑莓手機上本機運行。 導航到 `framework/ext/src/org/apache/cordova` 。 此時,您將看到所有的外掛程式目錄,所是的原始程式碼。 因此,添加目錄回顯到 `framework/ext/src/org/apache/cordova/echo` ,並創建一個檔稱為 `Echo.java` 在`framework/ext/src/org/apache/cordova/echo/Echo.java`. + +## 書寫 Echo.java + +在編寫外掛程式背後的基本思想是,創建一個擴展外掛程式類的類調用的方法 `execute` 返回 `PluginResult` 類。 任何調用 `cordova.exec` 將傳遞給要在類中,以及參數內執行的操作中。 在這種情況下,"回聲"是我們想要執行的類中"回聲"和 [乙方] 的行動是我們在中傳遞的參數。 + + package org.apache.cordova.echo; + + import org.apache.cordova.api.Plugin; + import org.apache.cordova.api.PluginResult; + import org.apache.cordova.json4j.JSONArray; + import org.apache.cordova.json4j.JSONException; + import org.apache.cordova.json4j.JSONObject; + /** + * A simple plugin to demonstrate how to build a plugin for BlackBerry + * Basically echos back the msg that a user calls to this plugin + */ + public final class Echo extends Plugin { + + public static final String echo = "echo"; + + public PluginResult execute(String action, JSONArray args, String callbackId) { + PluginResult result = new PluginResult(PluginResult.Status.INVALID_ACTION, "Echo: Invalid action:" + action); + if(action.equals(echo)){ + try { + String theMsg = args.getString(0); + if(theMsg!= null || theMsg.length()>0){ + result = new PluginResult(PluginResult.Status.OK, theMsg); + }else{ + result = new PluginResult(PluginResult.Status.ERROR, "Nothing to echo."); + } + } catch (JSONException e) { + result = new PluginResult(PluginResult.Status.JSON_EXCEPTION, e.getMessage()); + } + } + + return result; + } + + } + + +所以如果我們看看上面的代碼,我們可以看到在 execute 方法中,我們第一次尋找行動來。 Echo 外掛程式,只有一種操作, `echo` ,因此,我們將只檢查的。 如果我們的外掛程式有更多的行動,它是簡單的添加更多條件的測試,以檢查這些操作。 + +然後我們拿進來從參數 args 參數由提供的消息。 我們可以抓住的只在做第一個參數`String theMsg = args.getString(0);`. + +我們將做一些錯誤檢查和郵件看起來很好,如果我們將具現化新的 PluginResult 與好的狀態: `PluginResult.Status.OK` ,並返回該郵件: `theMsg` 。 在此之後,我們返回的結果,要傳遞回給 JavaScript 可以在回檔中成功發射。 如果事情失敗,我們可以返回各種狀態異常,像 `PluginResult.Status.ERROR` , `PluginResult.Status.JSON_EXCEPTION` ,或 `PluginResult.Status.INVALID_ACTION` 。 當傳遞回來時,這些類型的結果火中 JavaScript 的失敗回檔。 + +## 更新您的專案 www 目錄中.jar + +添加的 `Echo.java` 需要更新您的專案中。 若要生成 `.jar` 檔,定位到黑莓 WebWorks 回購根目錄下並運行 `ant` 命令: + + ant update -Dproject.path="~/path_to_my_project" + + +這將生成新的 `.jar` 檔在 `build/ext` 目錄。複製 `build/ext/cordova.jar` 檔到您 `project/www/ext` 目錄。 + +如果一切順利,允許您在黑莓手機中使用 Echo 外掛程式。 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/dev/guide/platforms/blackberry/tools.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/dev/guide/platforms/blackberry/tools.md b/www/docs/zh-cn/dev/guide/platforms/blackberry/tools.md new file mode 100644 index 0000000..7ed7127 --- /dev/null +++ b/www/docs/zh-cn/dev/guide/platforms/blackberry/tools.md @@ -0,0 +1,66 @@ +--- +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 的替代,您需要從[cordova.apache.org][1]下載此版本的科爾多瓦。 下載檔案中包含單獨的檔案,為每個平臺。 展開您想要的目標平臺。 這裡描述的工具,通常可用在頂級 `bin` 目錄中,否則為諮詢**自述**檔,瞭解有關更多詳細的指示。 + + [1]: http://cordova.apache.org + +## 創建一個專案 + +運行 `create` 命令,指定的現有路徑的專案、 反向域式包識別碼和應用程式的顯示名稱。這裡是 Mac 和 Windows 的語法: + + $ /path/to/cordova-blackberry-webworks/bin/create /path/to/my_new_project com.example.project_name ProjectName + $ /path/to/cordova-blackberry-webworks/bin/create.bat /path/to/my_new_project com.example.project_name ProjectName + + +**注:**黑莓平臺忽略套裝軟體名稱的預留位置 ( `com.example.project_name` ),但它已仍需使用的跨平臺的工具。 + +## 生成專案 + +對於黑莓手機的專案,請確保您自訂 `project.properties` 在科爾多瓦專案的根目錄中的檔。 你需要提供你的黑莓手機簽名金鑰的密碼,這樣做並指定黑莓 WebWorks SDK 和黑莓模擬程式的可執行檔的位置。 + + $ /path/to/my_new_project/cordova/build + $ /path/to/my_new_project/cordova/build.bat + + +## 啟動模擬程式 + +對於黑莓手機的專案,請確保您自訂 `project.properties` 科爾多瓦專案目錄的根目錄中的檔。 你需要提供你的黑莓手機簽名金鑰的密碼,這樣做並指定黑莓 WebWorks SDK 和黑莓模擬程式的可執行檔的位置。 + + $ /path/to/my_new_project/cordova/run + + +然後選擇 '否' 時提示您: + + 你有一個黑莓設備連接到您的電腦嗎?(y/n) $ /path/to/my_new_project/cordova/run < 平臺 > + + +然後選擇 '否' 時提示您: + + 你有一個黑莓設備連接到您的電腦嗎?(y /) n + + +## 日誌記錄 + +不幸的是,流直接從設備日誌是目前不支援的。 然而,黑莓手機提供了內置 Web 檢查器支援 Playbook 和黑莓智慧手機設備運行黑莓 OS 7.0 及以上。 您還可以訪問您的應用程式日誌 (包括對任何調用 `console.log` ) 在您的設備,在按住 ALT 鍵從主畫面和鍵入 lglg 鍵上。 \ 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