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 34F4118F42 for ; Wed, 6 Apr 2016 09:27:21 +0000 (UTC) Received: (qmail 76256 invoked by uid 500); 6 Apr 2016 09:27:19 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 76213 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 74605 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 DDDCFE08BF; 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:47 -0000 Message-Id: <1a07cb5f40ce46b786d6f942bbe6c094@git.apache.org> In-Reply-To: <0ea60741dd3e40f489f34a02f10641c5@git.apache.org> References: <0ea60741dd3e40f489f34a02f10641c5@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [31/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.5.0/cordova/storage/parameters/version.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.5.0/cordova/storage/parameters/version.md b/www/docs/zh-cn/3.5.0/cordova/storage/parameters/version.md new file mode 100644 index 0000000..e0a8a3b --- /dev/null +++ b/www/docs/zh-cn/3.5.0/cordova/storage/parameters/version.md @@ -0,0 +1,25 @@ +--- +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: database_version +--- + +# database_version + +資料庫的版本。 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.5.0/cordova/storage/sqlerror/sqlerror.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.5.0/cordova/storage/sqlerror/sqlerror.md b/www/docs/zh-cn/3.5.0/cordova/storage/sqlerror/sqlerror.md new file mode 100644 index 0000000..67e2199 --- /dev/null +++ b/www/docs/zh-cn/3.5.0/cordova/storage/sqlerror/sqlerror.md @@ -0,0 +1,46 @@ +--- +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: SQLError +--- + +# SQLError + +A `SQLError` 物件當發生錯誤時引發。 + +## 屬性 + +* **代碼**: 下面列出的預定義的錯誤代碼之一。 + +* **消息**: 錯誤的說明。 + +## 常量 + +* `SQLError.UNKNOWN_ERR` +* `SQLError.DATABASE_ERR` +* `SQLError.VERSION_ERR` +* `SQLError.TOO_LARGE_ERR` +* `SQLError.QUOTA_ERR` +* `SQLError.SYNTAX_ERR` +* `SQLError.CONSTRAINT_ERR` +* `SQLError.TIMEOUT_ERR` + +## 說明 + +`SQLError`物件運算元據庫時出現錯誤時引發。 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.5.0/cordova/storage/sqlresultset/sqlresultset.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.5.0/cordova/storage/sqlresultset/sqlresultset.md b/www/docs/zh-cn/3.5.0/cordova/storage/sqlresultset/sqlresultset.md new file mode 100644 index 0000000..b8efb5c --- /dev/null +++ b/www/docs/zh-cn/3.5.0/cordova/storage/sqlresultset/sqlresultset.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: SQLResultSet +--- + +# SQLResultSet + +當 `[SQLTransaction](../sqltransaction/sqltransaction.html)` 物件的 `executeSql` 方法時,執行指定的回檔 `SQLResultSet` 參數。 + +## 屬性 + +* **insertId**: 行的行的 ID, `SQLResultSet` 物件的 SQL 語句插入到資料庫中。 + +* **rowsAffected**: 由零如果該語句不會影響任何行的 SQL 語句更改的行數。 + +* **行**: `[SQLResultSetRowList](../sqlresultsetrowlist/sqlresultsetrowlist.html)` 表示返回的行,如果未返回行,則為空。 + +## 詳細資訊 + +當 `[SQLTransaction](../sqltransaction/sqltransaction.html)` 物件的 `executeSql` 方法時,執行指定的回檔 `SQLResultSet` 參數,其中包含三個屬性: + +* `insertId`返回組裝成功的 SQL 插入語句的行號。如果 SQL 不會插入任何行, `insertId` 未設置。 + +* `rowsAffected`始終是 `` 為一個 SQL `select` 語句。為 `insert` 或 `update` 它返回的數的語句修改的行。 + +* 決賽 `SQLResultSetList` 包含從一個 SQL select 語句返回的資料。 + +## 支援的平臺 + +* Android 系統 +* 黑莓手機 WebWorks (OS 6.0 和更高) +* iOS +* Tizen + +## 執行 SQL 快速示例 + + 函數 queryDB(tx) {tx.executeSql (' 選擇 * 從演示 '、 []、 querySuccess、 errorCB);}函數 querySuccess (德克薩斯州,結果) {console.log ("返回行 ="+ results.rows.length) ;/ / 這將是真實的因為這是一條 select 語句,所以 rowsAffected 是 0,如果 (! results.rowsAffected) {console.log ('沒有行受影響!') ;返回 false ;} / / 的 insert 語句,此屬性將返回的最後插入的行 console.log 的 ID ("最後插入的行 ID ="+ results.insertId);}函數 errorCB(err) {警報 ("處理 SQL 時出錯:"+ err.code);}var db = window.openDatabase ("資料庫"、"1.0","科爾多瓦演示",200000) ;db.transaction errorCB queryDB) ; + + +## 完整的示例 + + < html >< 頭 >< 標題 > 存儲示例 < / 標題 >< 腳本類型 ="文本/javascript"charset ="utf 8"src="cordova.js">< / 腳本 >< 腳本類型 ="文本/javascript"charset ="utf 8"> / / 等待設備 API 庫載入 / / document.addEventListener ("deviceready",onDeviceReady,false);/ / 填充資料庫 / / 函數 populateDB(tx) {tx.executeSql ('下拉表如果存在演示') ;tx.executeSql (' 創建表如果不存在演示 (id 唯一的資料) ') ;tx.executeSql (' 的值插入到演示 (id、 資料) (1,"第一行") ') ;tx.executeSql (插入到演示 (id、 資料) 值 (2,"第二行")) ;} / / 查詢資料庫 / / 函數 queryDB(tx) {tx.executeSql (' 選擇 * 從演示 '、 []、 querySuccess、 errorCB) ;} / / 查詢成功回檔 / / 函數 querySuccess (德克薩斯州,結果) {console.log ("返回行 ="+ results.rows.length) ;/ / 這將是真實的因為這是一條 select 語句,所以 rowsAffected 是 0,如果 ( ! results.rowsAffected) {console.log ('沒有行受影響!') ;返回 false ;} / / 的 insert 語句,此屬性將返回的最後插入的行 console.log 的 ID ("最後插入的行 ID ="+ results.insertId) ;} / / 交易錯誤回檔 / / 函數 errorCB(err) {console.log ("處理 SQL 時出錯:"+ err.code) ;} / / 交易成功回檔 / / 函數 successCB() {var db = window.openDatabase ("資料庫"、"1.0","科爾多瓦演示",200000) ;db.transaction errorCB queryDB) ;} / / 設備的 Api 可 / / 函數 onDeviceReady() {var db = window.openDatabase ("資料庫"、"1.0","科爾多瓦演示",200000) ;db.transaction (populateDB、 errorCB、 successCB) ;} < / 腳本 >< / 頭 >< 身體 >< h1 > 示例 < / h1 >< p > 資料庫

< / 身體 >< / html > \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.5.0/cordova/storage/sqlresultsetrowlist/sqlresultsetrowlist.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.5.0/cordova/storage/sqlresultsetrowlist/sqlresultsetrowlist.md b/www/docs/zh-cn/3.5.0/cordova/storage/sqlresultsetrowlist/sqlresultsetrowlist.md new file mode 100644 index 0000000..dea416d --- /dev/null +++ b/www/docs/zh-cn/3.5.0/cordova/storage/sqlresultsetrowlist/sqlresultsetrowlist.md @@ -0,0 +1,53 @@ +--- +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: SQLResultSetRowList +--- + +# SQLResultSetRowList + +屬性之一的 `[SQLResultSet](../sqlresultset/sqlresultset.html)` 從 SQL 查詢中包含的行返回。 + +## 屬性 + +* **長度**: SQL 查詢所返回的行數。 + +## 方法 + +* **專案**: 返回 JavaScript 物件所表示的指定索引處的行。 + +## 詳細資訊 + +`SQLResultSetRowList`包含從 SQL 返回的資料 `select` 語句。 該物件包含 `length` 屬性,該值多少行 `select` 語句返回。 若要獲取的資料行,調用 `item` 方法,以指定一個索引。 它返回 JavaScript `Object` 其屬性是的資料庫列 `select` 反對執行語句。 + +## 支援的平臺 + +* Android 系統 +* 黑莓手機 WebWorks (OS 6.0 和更高) +* iOS +* Tizen + +## 執行 SQL 快速示例 + + 函數 queryDB(tx) {tx.executeSql (' 選擇 * 從演示 '、 []、 querySuccess、 errorCB);}函數 querySuccess (德克薩斯州,結果) {var len = results.rows.length ;console.log ("演示表:"+ len +"行發現") ;為 (var 我 = 0 ; 我 < len ; i + +) {console.log ("行 ="+ i +"ID ="+ results.rows.item (i).id +"的資料 ="+ results.rows.item(i).data) ;}} 函數 errorCB(err) {警報 ("處理 SQL 時出錯:"+ err.code) ;} var db = window.openDatabase ("資料庫"、"1.0","科爾多瓦演示",200000) ;db.transaction errorCB queryDB) ; + + +## 完整的示例 + + < html >< 頭 >< 標題 > 存儲示例 < / 標題 >< 腳本類型 ="文本/javascript"charset ="utf 8"src="cordova.js">< / 腳本 >< 腳本類型 ="文本/javascript"charset ="utf 8"> / / 等待設備 API 庫載入 / / document.addEventListener ("deviceready",onDeviceReady,false);/ / 填充資料庫 / / 函數 populateDB(tx) {tx.executeSql ('下拉表如果存在演示') ;tx.executeSql (' 創建表如果不存在演示 (id 唯一的資料) ') ;tx.executeSql (' 的值插入到演示 (id、 資料) (1,"第一行") ') ;tx.executeSql (插入到演示 (id、 資料) 值 (2,"第二行")) ;} / / 查詢資料庫 / / 函數 queryDB(tx) {tx.executeSql (' 選擇 * 從演示 '、 []、 querySuccess、 errorCB) ;} / / 查詢成功回檔 / / 函數 querySuccess (德克薩斯州,結果) {var len = results.rows.length ;console.log ("演示表:"+ len +"行發現") ;為 (var 我 = 0 ; 我 < len ; i + +) {console.log ("行 ="+ i +"ID ="+ results.rows.item (i).id +"的資料 ="+ results.rows.item(i).data) ;}} / / 交易錯誤回檔 / / 函數 errorCB(err) {console.log ("處理 SQL 時出錯:"+ err.code) ;} / / 交易成功回檔 / / 函數 successCB() {var db = window.openDatabase ("資料庫"、"1.0","科爾多瓦演示",200000) ;db.transaction errorCB queryDB) ;} / / 設備的 Api 可 / / 函數 onDeviceReady() {var db = window.openDatabase ("資料庫"、"1.0","科爾多瓦演示",200000) ;db.transaction (populateDB、 errorCB、 successCB) ;} < / 腳本 >< / 頭 >< 身體 >< h1 > 示例 < / h1 >< p > 資料庫

< / 身體 >< / html > \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.5.0/cordova/storage/sqltransaction/sqltransaction.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.5.0/cordova/storage/sqltransaction/sqltransaction.md b/www/docs/zh-cn/3.5.0/cordova/storage/sqltransaction/sqltransaction.md new file mode 100644 index 0000000..ab577ba --- /dev/null +++ b/www/docs/zh-cn/3.5.0/cordova/storage/sqltransaction/sqltransaction.md @@ -0,0 +1,111 @@ +--- +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: SQLTransaction +--- + +# SQLTransaction + +允許對資料庫的 SQL 語句的執行。 + +## 方法 + +* **executeSql**: 執行一個 SQL 語句。 + +## 詳細資訊 + +調用 `Database` 物件的交易方法,刀路 `SQLTransaction` 指定的回檔方法的物件。 + +## 支援的平臺 + +* Android 系統 +* 黑莓手機 WebWorks (OS 6.0 和更高) +* iOS +* Tizen + +## 執行 SQL 快速示例 + + function populateDB(tx) { + tx.executeSql('DROP TABLE IF EXISTS DEMO'); + tx.executeSql('CREATE TABLE IF NOT EXISTS DEMO (id unique, data)'); + tx.executeSql('INSERT INTO DEMO (id, data) VALUES (1, "First row")'); + tx.executeSql('INSERT INTO DEMO (id, data) VALUES (2, "Second row")'); + } + + function errorCB(err) { + alert("Error processing SQL: "+err); + } + + function successCB() { + alert("success!"); + } + + var db = window.openDatabase("Database", "1.0", "Cordova Demo", 200000); + db.transaction(populateDB, errorCB, successCB); + + +## 完整的示例 + + + + + Storage Example + + + + + +

Example

+

SQLTransaction

+ + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.5.0/cordova/storage/storage.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.5.0/cordova/storage/storage.md b/www/docs/zh-cn/3.5.0/cordova/storage/storage.md new file mode 100644 index 0000000..082c3e4 --- /dev/null +++ b/www/docs/zh-cn/3.5.0/cordova/storage/storage.md @@ -0,0 +1,68 @@ +--- +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: 存儲 +--- + +# 存儲 + +> 科爾多瓦的存儲選項的概述。 + +幾個存儲 Api 是用於科爾多瓦的應用程式。請參閱[html5rocks][1]。為更全面地概述和示例。 + + [1]: http://www.html5rocks.com/en/features/storage + +## 認為 + +此 API 也已知作為*web 存儲*、*簡單的存儲*,或由其備用*會話存儲*介面,提供同步鍵/值對存儲,是可用基礎 web 視圖實現中。 請參閱[W3C 規範][2]的詳細資訊。 + + [2]: http://www.w3.org/TR/webstorage/ + +**Windows Phone 7 怪癖**: 點標記法是*不*提供,所以一定要使用 `setItem` 或 `getItem` ,而不是在作為便捷鍵直接從存儲的物件,`window.localStorage.someKey`. + +## WebSQL + +此 API 是在底層 web 視圖中可用。 [Web SQL 資料庫規範][3]提供更多的功能全面的資料庫表訪問通過 SQL 查詢。 + + [3]: http://dev.w3.org/html5/webdatabase/ + +在以下平臺支援 WebSQL: + +* Android 系統 +* 黑莓 10 +* iOS +* Tizen + +## IndexedDB + +此 API 是在底層 web 視圖中可用。[索引的 DB][4]提供比認為更多的功能,但比 WebSQL 較少。 + + [4]: http://www.w3.org/TR/IndexedDB/ + +在以下平臺支援 IndexedDB: + +* Windows Phone 8 +* 黑莓 10 + +## 基於外掛程式的選項 + +除了上面列出的 Api 的存儲、[檔 API][5]允許您緩存在本地檔案系統上的資料。 其他[科爾多瓦外掛程式][6]提供類似的存儲選項。 + + [5]: https://github.com/apache/cordova-plugin-file/blob/master/doc/index.md + [6]: http://plugins.cordova.io/ \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.5.0/cordova/storage/storage.opendatabase.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.5.0/cordova/storage/storage.opendatabase.md b/www/docs/zh-cn/3.5.0/cordova/storage/storage.opendatabase.md new file mode 100644 index 0000000..13dad8a --- /dev/null +++ b/www/docs/zh-cn/3.5.0/cordova/storage/storage.opendatabase.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: 大概 +--- + +# 大概 + +返回一個新的 `Database` 物件。 + + var dbShell = window.openDatabase(database_name, database_version, database_displayname, database_size); + + +## 說明 + +方法創建一個新的 SQL Lite 資料庫並返回 `Database` 允許對資料進行操作的物件。 + +## 支援的平臺 + +* Android 系統 +* 黑莓手機 WebWorks (OS 6.0 和更高) +* iOS +* Tizen + +## 快速的示例 + + var db = window.openDatabase("test", "1.0", "Test DB", 1000000); + + +## 完整的示例 + + + + + Storage Example + + + + + +

Example

+

Open Database

+ + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.5.0/guide/appdev/privacy/index.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.5.0/guide/appdev/privacy/index.md b/www/docs/zh-cn/3.5.0/guide/appdev/privacy/index.md new file mode 100644 index 0000000..efe912e --- /dev/null +++ b/www/docs/zh-cn/3.5.0/guide/appdev/privacy/index.md @@ -0,0 +1,60 @@ +--- +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: 隱私指南 +--- + +# 隱私指南 + +手機隱私是每個應用程式開發者必須解決的關鍵問題。 您的使用者期望將搜集他們的私人資訊,並由您的應用程式得到適當的處理。此外,有越來越多的現在有關于手機隱私慣例的法律要求司法管轄區。 + +本指南中的移動應用程式的隱私應被視為一*底漆*處理一些最重要的問題。 它概述了人們廣泛接受的一些最佳做法,並提供到其他更詳細的指南和參考參考。 + +* **私隱政策**: 您的應用程式應包括私隱政策,解決什麼樣的資訊您的應用程式收集來自或關於您的使用者、 如何使用這些資訊,與誰它共用的和如何使用者可以在應用程式內私隱有關的選擇等主題。以説明理解,你應該使用普通語言和避免技術術語。 你應該使您的隱私權原則可供使用者之前下載,如審查的 app 描述中的應用市場。 此外,應使您的隱私權原則可用在該應用程式本身的範圍內。 有限的行動裝置的顯示大小創建用於向使用者顯示私隱政策的挑戰。 考慮發展一種*縮寫形式*的政策,其中包括最重要的資訊,,然後在更多的細節感興趣的人提供一個連結到"長表"政策。 幾個小組正試圖開發基於圖示通信隱私慣例,你可能想要考慮一旦這些標準成熟的標準。 + +* **敏感資訊的收集**: 敏感的個人資訊的應用程式的集合將引發重要隱私問題。 敏感的個人資訊的例子包括敏感的財務資訊,健康的資訊,並從或兒童的資訊。 它還包括從某些感應器和通常發現行動裝置和平板電腦、 地理定位資訊、 連絡人/電話簿、 麥克風/相機和存儲的圖片視頻等的資料庫收集的資訊。 請參見以下文檔頁的詳細資訊:[相機][1]、[捕獲][2]、[連絡人][3]和[地理定位][4]。 一般情況下,您應該獲得使用者的明確許可之前收集敏感資訊,如果可能的話,提供一種控制機制,使使用者可以輕鬆地更改許可權。 應用程式的作業系統可以説明在某些情況下提出只是時間的對話方塊,要求使用者的許可權前集合。 在這些情況下,一定要利用任何機會,若要自訂對話方塊的框文本,以澄清如何應用程式使用,並且,如果適用,將共用此類資 訊。 + +* **避免使用者驚喜**: 如果您的應用程式收集或使用中可能向使用者根據您的應用程式 (例如,訪問存儲的圖片的音樂播放機) 的主要目的令人驚訝的方式的資訊,你應該帶類似的步驟作為敏感個人資訊的收集。 這就是,你強烈應考慮只是時間對話方塊通知使用者有關集合或該資訊的使用,並提供一個相應的隱私控制項,如果合適的話,的使用。 + +* **協力廠商資料收集或分享**: 如果你的應用程式收集到另一家公司 — — 提供的資訊,如一個社交網路平臺或廣告網路 (例如,如果您的應用程式會顯示廣告) — — 你應該告知該集合的使用者和共用。 至少,您的隱私權原則應該描述資訊收集和共用和,如果合適的話,為您的使用者提供控制能力或退出這種集合或共用。 + +* **集合限制和安全**: 您的使用者委託他們的資訊與您的應用程式,他們期望你將會採取適當的安全防範措施來保護它。 避免個人資訊的安全妥協的最佳方法之一併不是在第一次的地方收集的資訊,除非您的應用程式具有集合的一個具體和合法的商業原因。 不會需要收集的資訊,確保你提供適當的安全控制,以保護該資訊,無論它存儲在設備上或在您的後端伺服器上。 您還應開發這款應用和後端伺服器上實施適當的資料保留原則。 + + [1]: cordova_camera_camera.md.html + [2]: cordova_media_capture_capture.md.html + [3]: cordova_contacts_contacts.md.html + [4]: cordova_geolocation_geolocation.md.html + +以下是一些其他有用手機隱私指南,開發人員: + +* 加州總檢察長[私隱去: 移動生態系統的建議][5] + +* 民主與技術,隱私論壇,[為手機應用程式開發人員的最佳做法][6]的未來中心 + +* CTIA 無線協會、[最佳做法和準則的位置基於服務][7] + +* 聯邦貿易委員會,[手機隱私披露: 建立信任通過透明度][8] + +* [應用隱私][9]網站隱私論壇的未來 + + [5]: http://oag.ca.gov/sites/all/files/pdfs/privacy/privacy_on_the_go.pdf + [6]: http://www.futureofprivacy.org/wp-content/uploads/Best-Practices-for-Mobile-App-Developers_Final.pdf + [7]: http://www.ctia.org/business_resources/wic/index.cfm/AID/11300 + [8]: http://www.ftc.gov/os/2013/02/130201mobileprivacyreport.pdf + [9]: http://www.applicationprivacy.org \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.5.0/guide/appdev/whitelist/index.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.5.0/guide/appdev/whitelist/index.md b/www/docs/zh-cn/3.5.0/guide/appdev/whitelist/index.md new file mode 100644 index 0000000..e41a911 --- /dev/null +++ b/www/docs/zh-cn/3.5.0/guide/appdev/whitelist/index.md @@ -0,0 +1,141 @@ +--- +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]規範,它依賴于 `` 中應用程式的元素 `config.xml` 檔以啟用對特定域的網路訪問。 對於依賴于所述的命令列介面 CLI 工作流的專案,此檔位於專案的頂級目錄。 否則為特定于平臺的發展道路,位置列出以下各節。 (每個平臺上見各種平臺指南的詳細資訊)。 + + [1]: http://www.w3.org/TR/widgets-access/ + +下面的示例演示白名單中的語法: + +* [Google.com][2]訪問: + + + + +* 對安全[google.com][3]的訪問 ( `https://` ): + + + + +* 子域[maps.google.com][4]訪問: + + + + +* 對所有子域[google.com][2],例如[mail.google.com][5]和[docs.google.com][6]的訪問: + + + + +* 到*所有*的域,例如, [google.com][2]和[developer.mozilla.org][7]的訪問: + + + + + 這是新創建的 CLI 專案的預設值。 + + [2]: http://google.com + [3]: https://google.com + [4]: http://maps.google.com + [5]: http://mail.google.com + [6]: http://docs.google.com + [7]: http://developer.mozilla.org + +## 亞馬遜火 OS 白 + +在找到特定平臺白規則`res/xml/config.xml`. + +## Android 白 + +在找到特定平臺白規則`res/xml/config.xml`. + +**注**: 在 Android 2.3 上和之前,域白僅適用于 `href` 的超連結,不引用的資源,如圖像和腳本。 採取步驟,避免從被注入到應用程式的腳本。 + +導航到非白名單域通過 `href` 的超連結會導致要打開預設瀏覽器中,而不是在應用程式中的頁。(比較這到下面提到的 iOS 的行為)。 + +## iOS 白 + +該平臺的白規則命名的應用程式目錄中找到 `config.xml` 檔。 + +沒有一個協定,如指定的起源 `www.apache.org` 而不是 `http://www.apache.org` ,預設為所有的 `http` , `https` , `ftp` ,和 `ftps` 計畫。 + +在 iOS 平臺上的萬用字元是比在[W3C 構件訪問][1]規範更靈活。 例如,以下訪問所有子域和頂層網域如 `.com` 和 `.net` : + + + + +與上文指出的對非白名單域通過導航的 Android 平臺不同的是 `href` iOS 上的超連結可以防止頁面打開在所有。 + +## 黑莓 10 白 + +在找到白規則`www/config.xml`. + +黑莓 10 位使用萬用字元有別于其他平臺兩種方式: + +* 通過訪問任何內容 `XMLHttpRequest` 必須顯式聲明。 設置 `origin="*"` 不在這種情況下工作。 另外,所有 web 安全性可能會都禁用使用 `WebSecurity` 黑莓手機配置中所述的首選項: + + + + +* 作為替代設置 `*.domain` ,設置附加 `subdomains` 屬性為 `true` 。 它應設置為 `false` ,預設情況。 例如,以下允許訪問 `google.com` , `maps.google.com` ,和 `docs.google.com` : + + + + + 以下縮小訪問到 `google.com` : + + + + + 指定訪問到所有的域,包括本地 `file://` 協定: + + + +(有關支援的詳細資訊,請參閱黑莓的文檔[訪問元素][8]上.) + + [8]: https://developer.blackberry.com/html5/documentation/ww_developing/Access_element_834677_11.html + +## 3.1.0 的 iOS 變化 + +之前 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`(隨機缺少字母的萬用字元): 不再支援這些 ;更改包含為每個域和協定,你實際上需要到白名單中的一線。 + +## Windows Phone 白 + +Windows Phone 7 和 8 的白規則發現在應用程式中的 `config.xml` 檔。 + +## Tizen 白 + +白規則發現在應用程式中的 `config.xml` 檔。 在平臺上同樣依賴于 `subdomains` 屬性作為黑莓平臺。 (有關支援的詳細資訊,請參閱 Tizen 的文檔[訪問元素][9]上.) + + [9]: https://developer.tizen.org/help/index.jsp?topic=%2Forg.tizen.web.appprogramming%2Fhtml%2Fide_sdk_tools%2Fconfig_editor_w3celements.htm \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.5.0/guide/cli/index.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.5.0/guide/cli/index.md b/www/docs/zh-cn/3.5.0/guide/cli/index.md new file mode 100644 index 0000000..2936bd4a --- /dev/null +++ b/www/docs/zh-cn/3.5.0/guide/cli/index.md @@ -0,0 +1,379 @@ +--- +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 是要使用的跨平臺工作流的主要工具 (見有關的各項工作流程說明概述)。然而,你也可以使用 CLI 初始化專案代碼後,您使用各種平臺 Sdk 和外殼工具為繼續發展。 + +## 系統必備元件 + +在運行任何命令列工具之前, 您需要為每個您想要的目標的平臺安裝 Sdk。(參見平臺指南更多詳細資訊。 + +若要添加支援或重建任何平臺的一個專案,您需要從支援的平臺 SDK 的同一台電腦上運行命令列介面。CLI 支援以下組合: + +* iOS (Mac) +* 亞馬遜火 OS (Mac、 Linux、 Windows) +* 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` 命令列上。 + + **注**: `-g` 標誌上面告訴故宮全域安裝科爾多瓦。 您可能需要添加到您的路徑,為了調用全域的故宮目錄安裝故宮模組。 在 Windows 上,故宮通常可以找到在 `C:\Users\username\AppData\Roaming\npm` 和在 Unix 上`/usr/local/share/npm`. + + [1]: http://nodejs.org/ + +## 創建應用程式 + +轉至目錄位置您維護您的原始程式碼,並運行以下命令: + + $ cordova create hello com.example.hello HelloWorld + + +它可能需要一些時間完成的命令,有耐心。運行該命令與 `-d` 選項將顯示有關其進度的資訊。 + +*你好*第一個參數指定要為您的專案生成的目錄。 此目錄不應該存在,科爾多瓦將為您創建它。 其 `www` 子目錄的房子您應用程式的主頁上,與各種資源下 `css` , `js` ,和 `img` ,其中遵循共同 web 發展的檔命名約定。 `config.xml`檔包含生成和分發應用程式所需的重要的中繼資料。 + +第二個參數 `com.example.hello` 為您的專案提供了一個反向域樣式識別碼。 此參數是可選的但只有當你也省略第三個參數,因為參數是位置。 您可以編輯以後此值在 `config.xml` 檔中,但一定要注意可能生成外部的代碼 `config.xml` 使用此值,如 JAVA 套裝軟體名稱。 預設值是 `io.cordova.hellocordova` ,但它建議你選擇一個適當的值。 + +第三個參數 `HelloWorld` 提供了應用程式的顯示標題。 此參數是可選的。 您可以編輯以後此值在 `config.xml` 檔中,但一定要注意可能生成外部的代碼 `config.xml` 使用此值,如 JAVA 類的名稱。 預設值是 `HelloCordova` ,但它建議你選擇一個適當的值。 + +## 添加平臺 + +後面的所有命令都需要在專案的目錄或在其範圍內的任何子目錄內運行: + + $ cd hello + + +您可以生成專案之前,您需要指定一組的目標平臺。 您運行這些命令的能力取決於您的電腦是否支援每個 SDK,是否你已經安裝每個 SDK。 運行任何這些從 Mac: + + $ cordova platform add ios + $ cordova platform add amazon-fireos + $ 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 amazon-fireos + $ cordova platform add android + $ cordova platform add blackberry10 + $ cordova platform add firefoxos + + +運行此檢查當前設置的平臺: + + $ cordova platforms ls + + +(請注意 `platform` 和 `platforms` 命令是同義語.) + +請運行下列同義命令來刪除一個平臺之一: + + $ cordova platform remove blackberry10 + $ cordova platform rm amazon-fireos + $ cordova platform rm android + + +運行命令來添加或刪除平臺影響專案的*平臺*目錄的內容每個指定的平臺作為一個子目錄中的顯示位置。 *Www*原始目錄轉載內每個平臺的子目錄中,例如出現在 `platforms/ios/www` 或 `platforms/android/assets/www` 。 因為 CLI 不斷複製在源*www*資料夾中的檔,應只編輯這些檔,並不是位於*平臺*的子目錄下。 如果您使用的版本控制軟體,您應將此源*www*資料夾,該*合併*的資料夾,添加到您的版本控制系統。 (有關*合併*資料夾的詳細資訊可以找到下面的自訂每個平臺部分中) + +**警告**: 當使用 CLI 來構建您的應用程式,您是從編輯中的任何檔,強烈建議不要採用 `/platforms/` 資料夾除非你知道你正在做什麼,或特別在文檔中以其他方式告知。 這是因為中的檔 `/platforms/` direcotry 將被覆蓋上準備或外掛程式重新安裝。 + +如果您希望在此時,你可以使用 Eclipse 或 Xcode SDK 打開你創建的專案。 您將需要打開的資產從衍生金融工具集 `/platforms/` 要用 SDK 開發目錄。 這是因為 SDK 的特定元資料檔案存儲在相應的 `/platform/` 子目錄。 (見如何開發應用程式每個 IDE 內的資訊平臺指南)使用這種方法,如果你只是想要初始化使用 CLI 的專案,然後切換到 SDK 為本機的工作。 + +如果您想要使用的整個開發週期的跨平臺的工作流方式 (CLI),請繼續閱讀。 + +## 構建應用程式 + +預設情況下, `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 專案等。對於其他平臺,您可能需要首先將設備模擬程式與相關聯。 + +注: 模擬器支援目前不是可供亞馬遜火 OS + +(見平臺指南的詳細資訊)。例如,您可能會首先運行 `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 和亞馬遜火 OS 設備,你將必須啟用設備上的**USB 調試**的選項和或許添加 USB 驅動程式根據您發展導讀工作。 每個平臺的要求的詳細資訊,請參閱平臺指南。 + +## 添加外掛程式的功能 + +生成和查看一個新專案時,將顯示預設的應用程式不會很多。 您可以修改該應用程式在許多方面,利用標準的 web 技術,但應用程式緊密的聯繫,與各種設備級功能,您需要添加外掛程式,提供對核心科爾多瓦 Api 的訪問。 + +*外掛程式*是有點的載入項代碼的提供的本機組件的介面。 您可以設計您自己的外掛程式介面,例如,設計一個混合應用程式,與本機組件混合科爾多瓦 web 視圖時。 (請參閱嵌入 WebViews 和外掛程式開發指南的詳細資訊。更常見的是,您將添加外掛程式,以便啟用科爾多瓦的基本設備級功能詳細的 API Reference 中之一。 可以在[plugins.cordova.io][4]發現這些外掛程式,包括社會,所提供的附加外掛程式的清單。 你可以使用 CLI 來搜索外掛程式從此註冊表。 例如,搜索 `bar` 和 `code` 產生單個結果相匹配這兩個詞作為子字串不區分大小寫: + + [4]: http://plugins.cordova.io/ + + $ cordova plugin search bar code + + com.phonegap.plugins.barcodescanner - Scans Barcodes + + +僅搜索 `bar` 期限國債收益率和更多的結果: + + org.apache.cordova.statusbar - Cordova StatusBar Plugin + + +`cordova plugin add`命令需要您指定的外掛程式代碼的存儲庫。 請注意當你遵循 Web 專案開發工作流和使用 CLI,CLI 會照顧到適當的位置為每個平臺添加外掛程式的代碼。 (如果你是在本機專案開發工作流,您會添加外掛程式使用 Plugman (這裡指南連結),多次為每個平臺)。 + +這裡是如何使用 CLI 將功能添加到應用程式的示例: + +* 基本設備資訊 (設備 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 + + +你可以大量刪除或添加的外掛程式通過指定多個參數的每個命令: + + $ cordova plugin add org.apache.cordova.console org.apache.cordova.device + + +## 高級的外掛程式選項 + +當添加外掛程式,幾個選項允許您指定從何處獲取該外掛程式。 上面的示例使用知名 `registry.cordova.io` 註冊表和外掛程式指定的 `id` : + + $ cordova plugin add org.apache.cordova.console + + +`id`還可能包括外掛程式的版本號碼後, 追加 `@` 字元。`latest`版本是最新版本的別名。例如: + + $ cordova plugin add org.apache.cordova.console@latest + $ cordova plugin add org.apache.cordova.console@0.2.1 + + +如果在沒有註冊該外掛程式 `registry.cordova.io` 位於另一個 git 資源庫中,但您可以指定一個備用的 URL: + + $ cordova plugin add https://github.com/apache/cordova-plugin-console.git + + +上面的 git 示例讀取外掛程式末尾的主分支上,但可以後追加一個標記或分支如備用 git ref `#` 字元: + + $ cordova plugin add https://github.com/apache/cordova-plugin-console.git#r0.2.0 + + +如果外掛程式 (和其 `plugin.xml` 檔) 是在 git 回購協定內的子目錄中,您可以指定它與 `:` 的字元。 請注意, `#` 字元仍然需要: + + $ cordova plugin add https://github.com/someone/aplugin.git#:/my/sub/dir + + +您也可以組合 git ref 和子目錄: + + $ cordova plugin add https://github.com/someone/aplugin.git#r0.0.1:/my/sub/dir + + +或者,指定包含的外掛程式目錄的本地路徑 `plugin.xml` 檔: + + $ cordova plugin add ../my_plugin_dir + + +## 使用*合併*到自訂的每個平臺 + +而科爾多瓦允許您輕鬆地部署許多不同平臺的應用程式,有時需要添加自訂項。 在這種情況下,你不想修改中各項的原始程式碼檔 `www` 內的頂級目錄 `platforms` 目錄,,因為他們定期更換與頂級 `www` 目錄的跨平臺源。 + +相反,頂級 `merges` 目錄提供了一個指定資產在特定平臺上部署的地方。 每個特定于平臺的子目錄內 `merges` 鏡像的目錄結構的 `www` 源樹中,從而允許您重寫或根據需要添加的檔。 例如,在這裡是如何你可能會使用 `merges` 來推動 Android 和亞馬遜火 OS 設備的預設字型大小: + +* 編輯 `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)` 從相應的硬體按鈕的事件。 + +## 説明命令 + +科爾多瓦特點兩三個全域命令,可以説明你如果你卡住或遇到的問題。`help`命令顯示所有可用的科爾多瓦命令和它們的語法: + + $ cordova help + $ cordova # same + + +`info`命令產生的潛在的有用的詳細資訊,如當前安裝的平臺,為每個平臺 SDK 版本和外掛程式的 CLI 版本的清單和 `node.js` : + + $ cordova info + + +它既呈現到螢幕資訊並捕獲在本地輸出 `info.txt` 檔。 + +**注**: 目前,僅在 iOS 和 Android 平臺上的詳細資訊都可用。 + +## 更新科爾多瓦和您的專案 + +安裝後 `cordova` 實用程式,您可以始終進行更新到最新版本通過運行以下命令: + + $ sudo npm update -g cordova + + +使用此語法來安裝特定的版本: + + $ sudo npm install -g cordova@3.1.0-0.2.0 + + +運行 `cordova -v` 查看當前運行的版本。 運行 `npm +info` 命令長清單,其中包含當前版本以及其他可用的版本號: + + $ npm info cordova + + +科爾多瓦 3.0 是要支援這一節中描述的命令列介面的第一個版本。 如果您正在從 3.0 以前的版本更新,您需要創建一個新專案,如以上所述,然後將舊應用程式的資源複製到頂級 `www` 目錄。 在適用的情況,進一步有關升級到 3.0 的詳細資訊是可用的平臺指南中。 一旦你升級到 `cordova` 的命令列介面和使用 `npm update` 待當前,那裡所描述的更耗時過程不再相關。 + +科爾多瓦 3.0 + 可能仍然需要對專案級別的目錄結構和其他依賴關係的各種變化。 在您運行 `npm` 命令上面更新科爾多瓦本身,您可能需要確保您的專案資源符合最新的版本要求。 運行下面這樣的命令為每個平臺您正在構建: + + $ cordova platform update android + $ cordova platform update ios + ...etc. http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.5.0/guide/hybrid/plugins/index.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.5.0/guide/hybrid/plugins/index.md b/www/docs/zh-cn/3.5.0/guide/hybrid/plugins/index.md new file mode 100644 index 0000000..11f2bae --- /dev/null +++ b/www/docs/zh-cn/3.5.0/guide/hybrid/plugins/index.md @@ -0,0 +1,158 @@ +--- +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 視圖。 外掛程式提供對基於 web 的應用程式通常不可用的設備和平臺功能的訪問。 科爾多瓦 API 的所有主要功能作為外掛程式,實現和許多其他的可用條碼掃描器、 NFC 通信等功能的啟用或定制日曆的介面。 + +外掛程式包括一個單一的 JavaScript 介面和相應的本機代碼庫,每個受支援的平臺。 通過將一個字串從 JavaScript 傳遞到本機平臺再回來,一個可以作為模型使用以生成更複雜的功能,簡單的*echo*外掛程式這節步驟。 本節討論的基本外掛程式結構和麵向外部 JavaScript 介面。 對於每個相應的本機介面,請參閱此部分的結尾處的清單。 + +除了這些指令,當準備寫一個外掛程式最好是看看[現有的外掛程式][1]為指導。 + + [1]: https://github.com/apache/cordova-android/tree/master/framework/src/org/apache/cordova + +## 建設一個外掛程式 + +應用程式開發人員使用 CLI 的 `plugin add` 命令 (討論中命令列介面),對專案應用外掛程式。 該命令的參數是*git*資源庫中包含的外掛程式代碼的 URL。 此示例實現科爾多瓦的設備 API: + + $ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git + + +外掛程式存儲庫必須具備頂級 `plugin.xml` 清單檔。 有許多方式來配置此檔中,其中的詳細資訊是可用的外掛程式規範中。 此縮寫的版本的 `Device` 外掛程式提供了一個簡單的例子,使用作為一種模型: + + + + Device + Cordova Device Plugin + Apache 2.0 + cordova,device + + + + + + + + + + + + + + + +頂級 `plugin` 標記的 `id` 屬性使用相同的反向域格式所要添加到他們的應用程式識別的外掛程式包。 `js-module`標記指定共同的 JavaScript 介面的路徑。 `platform`標記為指定一組對應的本機代碼, `ios` 在這種情況下的平臺。 `config-file`標記封裝 `feature` 注入特定平臺的標記 `config.xml` 檔,以使該平臺意識到額外的代碼庫。 `header-file`和 `source-file` 標籤指定庫的元件檔的路徑。 + +## 驗證外掛程式 + +您可以使用 `plugman` 實用程式來檢查是否為每個平臺外掛程式安裝正確。 安裝 `plugman` 用下面的[節點][2]命令: + + [2]: http://nodejs.org/ + + $ npm install -g plugman + + +你需要有效的 app 原始目錄中,如頂級 `www` 目錄包含在預設生成的 CLI 專案中所述的命令列介面。 請確保應用程式的 `index.html` 的主頁引用名稱的外掛程式的 JavaScript 介面,好像它是相同的原始目錄中: + + + + +然後運行下面的命令: 若要測試是否能正常載入的 iOS 的依賴關係: + + $ plugman -platform ios /path/to/my/project/www /path/to/my/plugin + + +有關的詳細資訊 `plugman` 選項,請參閱使用 Plugman 到管理外掛程式。 有關如何實際*調試*外掛程式的資訊,請參閱此頁面的底部列出的每個平臺的本機介面。 + +## JavaScript 介面 + +JavaScript 提供了前置介面,使該外掛程式的或許最重要的部分。 然而你喜歡,但是你需要調用可以構造你的外掛程式 JavaScript `cordova.exec` 溝通與本機平臺,使用下面的語法: + + cordova.exec(function(winParam) {}, + function(error) {}, + "service", + "action", + ["firstArgument", "secondArgument", 42, false]); + + +這裡是每個參數的工作原理: + +* `function(winParam) {}`: 成功回呼函數。假設您 `exec` 調用成功完成,以及任何您傳遞給它的參數執行此函數。 + +* `function(error) {}`: 錯誤回呼函數。如果該操作未成功完成,此函數執行帶有可選錯誤參數。 + +* `"service"`: 要調用的本機一邊的服務名稱。這對應于本機類,為其更多的資料,可在下面列出的本機指南。 + +* `"action"`: 要調用的本機一邊的操作名稱。這通常對應于本機類的方法。請參閱下面列出的本機指南。 + +* `[/* arguments */]`: 要傳遞到本機環境中的參數陣列。 + +## 示例 JavaScript + +此示例演示一種方法來實現外掛程式的 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. + }); + + +看看的最後三個參數的 `cordova.exec` 函數。 第一次調用 `Echo` *的服務*,一個類名稱。 第二個請求 `echo` *行動*、 那類中的方法。 第三個是一個參數包含 echo 字串,該字串陣列 `window.echo` 函數的第一個參數。 + +成功回檔傳遞到 `exec` 是簡單地對回呼函數的引用 `window.echo` 花。 如果本機平臺觸發錯誤回檔,它只是調用成功回檔並傳遞它的預設字串。 + +## 本地介面 + +一旦你為你的外掛程式定義 JavaScript,你需要至少一個本機實現,補充。 下面,列出了每個平臺的詳細資訊和每個生成回聲外掛程式上面的簡單示例: + +* [亞馬遜火 OS 外掛程式](../../platforms/amazonfireos/plugin.html) +* [Android 外掛程式](../../platforms/android/plugin.html) +* [iOS 外掛程式](../../platforms/ios/plugin.html) +* [黑莓 10 外掛程式](../../platforms/blackberry10/plugin.html) +* [Windows Phone 外掛程式](../../platforms/wp8/plugin.html) + +Tizen 平臺不支援外掛程式。 + +## 發佈外掛程式 + +一旦你開發你的外掛程式,您可能希望將發佈與共享它,社會。 你可以將你的外掛程式發佈到科爾多瓦註冊表 (基於[ `npmjs` ][3]) 或任何其它 `npmjs` -基於註冊表。 其他開發人員可以將它要麼使用自動安裝 `plugman` 或科爾多瓦 CLI。 (每個發展路徑的詳細資訊,見到管理外掛程式和命令列介面使用 Plugman)。 + + [3]: 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.5.0/guide/hybrid/webviews/index.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.5.0/guide/hybrid/webviews/index.md b/www/docs/zh-cn/3.5.0/guide/hybrid/webviews/index.md new file mode 100644 index 0000000..3136971 --- /dev/null +++ b/www/docs/zh-cn/3.5.0/guide/hybrid/webviews/index.md @@ -0,0 +1,31 @@ +--- +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 視圖*在本機的移動平臺內實現的。 這一節演示如何,為支援平臺,以創建您自己的 web 視圖元件,充分使用科爾多瓦的 api。 然後,您可以部署在混合應用程式中的本機組件以及這些科爾多瓦應用程式元件。 + +若要部署 web 視圖,您需要熟悉每個本機程式設計環境。下面提供了支援的平臺的說明: + +* [亞馬遜火 OS WebViews](../../platforms/amazonfireos/webview.html) +* [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.5.0/guide/overview/index.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.5.0/guide/overview/index.md b/www/docs/zh-cn/3.5.0/guide/overview/index.md new file mode 100644 index 0000000..b23d849 --- /dev/null +++ b/www/docs/zh-cn/3.5.0/guide/overview/index.md @@ -0,0 +1,69 @@ +--- +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 視圖中的一個元件。 科爾多瓦提供*外掛程式*介面,使這些元件,以互相溝通。 + +## 發展路徑 + +從 3.0 版,可以使用兩種基本的工作流程來創建移動應用程式。 雖然您可以完成同樣的事情使用這兩個工作流,某些任務是更好地適合於使用在另一個工作流。 出於此原因,您應該瞭解這兩個工作流,以便您可以使用最佳的工具為最好的局面。 + +*Web 專案開發*工作流和*本機平臺開發*工作流支援的兩個主要工作流。 + +### Web 專案開發 + +你能想到的第一個工作流作為*Web 專案開發*工作流。 當您想要創建一個科爾多瓦運行應用程式在盡可能多的移動作業系統上盡可能以盡可能少的特定于平臺開發工作時,應使用此工作流。 此工作流進入了存在與科爾多瓦 3.0 和科爾多瓦*的命令列介面*(CLI) 的創作。 CLI 文摘走很多的照顧與構建您的應用程式涉及的細節的較低級別 shell 腳本的功能,如將複製您的 web 資產到正確的資料夾為每個移動平臺,平臺特定的配置更改,或運行特定生成腳本來生成應用程式二進位檔案。 你可以閱讀更多關於*Web 專案開發*工作流中的命令列介面。 請注意往往當人們說的"cli",他們正在談論此*Web 專案開發*工作流。 + +### 本機平臺開發 + +第二個工作流可以看作一個*本機平臺開發*工作流。 當你想要側重于建設為一個單一的平臺應用程式和感興趣的改變的較低級別平臺詳細資訊時,您應該使用它。 雖然仍然可以使用此工作流來構建跨平臺的應用程式,缺乏的工具進行抽象的各種生成步驟將會使它更加困難。 例如,必須使用 Plugman 來安裝您想要支援的每個平臺的同一外掛程式一次。 為使用此*本機平臺開發*工作流帶來的好處是的它使您能夠訪問到的較低級別 shell 腳本生成並測試應用程式,因此,如果你駭客本機側的事情,此工作流是最有效的方法來測試您的更改。 此工作流,也是恰當的如果您想要使用 CordovaWebView 作為一個更大的本機應用程式中的一小部分 (見嵌入 WebViews 指南 》)。您可以閱讀有關此工作流,在不同的 Shell 工具指南,例如,Android 殼工具指南和 iOS 殼工具指南 。 + +當剛開始的時候,它可能是最容易使用的*Web 專案開發*工作流來創建一個應用程式。 (若要安裝 CLI,參見命令列介面。根據您想要的目標的平臺的集,您可以依靠逐步更多地共用在開發週期的 CLI: + +* 在最基本的情況下,你可以使用 CLI 只是為了創建一個新專案填充,您要修改的預設配置。 + +* 對於很多的移動平臺,也可以使用 CLI 來設置內部每個 SDK 編譯所需的額外的專案檔案。 為此,您必須安裝每個目標的平臺 SDK。 (見平臺指南的說明)。如表中所示的平臺支援,您可能需要在目標平臺根據不同的作業系統上運行,CLI。 + +* 為支援平臺,CLI 可以編譯 executible 的應用程式和基於 SDK 的設備模擬程式中運行它們。 為全面的測試,還可以生成應用程式檔,並直接在設備上安裝它們。 + +在開發週期中的任何點,您可以切換到使用更多的*本機平臺開發*工作流。 提供的特定于平臺 SDK 工具可能會提供一組更豐富的選項。 (見有關每個平臺 SDK 工具的詳細資訊平臺指南設置)。 + +SDK 環境是更適當的如果你想要實現一個混合本機和基於 web 的應用程式元件的混合應用。 您可以使用命令列實用程式最初生成應用程式,或以反覆運算方式此後要喂 SDK 工具更新的代碼。 您也可以自己生成應用程式的設定檔。 (見 config.xml 檔的詳細資訊)。 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.5.0/guide/platforms/amazonfireos/config.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.5.0/guide/platforms/amazonfireos/config.md b/www/docs/zh-cn/3.5.0/guide/platforms/amazonfireos/config.md new file mode 100644 index 0000000..5945a70 --- /dev/null +++ b/www/docs/zh-cn/3.5.0/guide/platforms/amazonfireos/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: 亞馬遜火 OS 配置 +--- + +# 亞馬遜火 OS 配置 + +`config.xml`檔控制應用於每個應用程式和 CordovaWebView 實例的應用程式的基本設置。 此節詳細資訊首選項僅適用于亞馬遜火 OS 的基礎。 有關全域配置選項,請參閱 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.5.0/guide/platforms/amazonfireos/index.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.5.0/guide/platforms/amazonfireos/index.md b/www/docs/zh-cn/3.5.0/guide/platforms/amazonfireos/index.md new file mode 100644 index 0000000..3639325 --- /dev/null +++ b/www/docs/zh-cn/3.5.0/guide/platforms/amazonfireos/index.md @@ -0,0 +1,140 @@ +--- +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: 亞馬遜火 OS 平臺指南 +--- + +# 亞馬遜火 OS 平臺指南 + +本指南介紹如何設置您的 SDK 開發環境部署亞馬遜火 OS 的設備,如 Kindle 火 HDX 科爾多瓦應用軟體。 + +請參閱下列特定于平臺的詳細資訊: + +* [亞馬遜火 OS 配置](config.html) +* [亞馬遜火 OS WebViews](webview.html) +* [亞馬遜火 OS 外掛程式](plugin.html) + +## 要求和支援 + +亞馬遜火 os 開發科爾多瓦的應用程式需要 Android SDK 和亞馬遜 web 視圖 SDK。檢查的要求這些 Sdk 在下面的連結: + +* [Android SDK 系統][1] + +* [亞馬遜 web 視圖 SDK][2] + + [1]: http://developer.android.com/sdk/ + [2]: https://developer.amazon.com/sdk/fire/IntegratingAWV.html#installawv + +## 安裝 + +### Android SDK + +從[developer.android.com/sdk][1]安裝 Android SDK。 你可能會出現一個選擇在哪裡安裝 SDK,否則移動下載 `adt-bundle` 樹到無論您存儲的開發工具。 + +科爾多瓦命令列工具來工作,您需要包括 SDK 的 `tools` 和 `platform-tools` 的路徑環境中目錄。 + +關於 Mac、 Linux 或其他 unix 平臺,您可以使用文字編輯器來創建或修改 `~/.bash_profile` 檔中,添加行,如下,根據 SDK 的安裝位置: + + 匯出路徑 = ${路徑}:/開發/adt-捆綁/sdk/平臺-工具:/開發/adt-捆綁/sdk/工具 + + +這暴露了 SDK 工具在新打開的終端視窗。否則運行這使它們在當前會話中可用: + + 元源 ~/.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 + + +### 亞馬遜 web 視圖 SDK + +從[亞馬遜開發人員門戶][2]下載亞馬遜 web 視圖 SDK. + +* 創建 `libs/` 中的資料夾 `~/.cordova/lib/amazon-fireos/cordova/3.1.0/` 資料夾。 +* 添加 `awv_interface.jar` 從下載 SDK 進行`~/.cordova/lib/amazon-fireos/cordova/3.1.0/libs/` + +## 在 SDK 中打開的專案 + +使用 `cordova` 實用程式設置了一個新的專案,如所述在科爾多瓦命令列介面。例如,在原始程式碼中的目錄: + + $ cordova create hello com.example.hello "HelloWorld" + $ cd hello + $ cordova platform add amazon-fireos + $ cordova build + + +一旦創建了,這裡是如何使用 SDK 來修改它: + +* 啟動**Eclipse**應用程式。 + +* 選擇**新建專案**功能表項目。 + +* 從結果對話方塊中,選擇**從現有代碼的 Android 專案**並按**下一步**: ![][3] + +* 定位到 `hello` ,或無論你創建目錄的專案,然後到 `platforms/amazon-fireos` 子目錄。 + +* 按**完成**. + + [3]: {{ site.baseurl }}/static/img/guide/platforms//eclipse_new_project.png + +一旦日食視窗將打開,一個紅色的**X**可能似乎表明未解決的問題。如果是這樣,執行這些額外的步驟: + +* 按右鍵專案目錄。 + +* 在出現的**屬性**對話方塊中,選擇**Android**從功能窗格。 + +* 為專案生成目標,選擇您已安裝的最高的 Android API 級別。 + +* 按一下**確定**. + +* 從**專案**功能表中選擇**清潔**。這應該更正該專案中的所有錯誤。 + +## 將部署到設備 + +要將應用程式推直接到設備,請確保您的設備上的[Android 開發者網站][4],所述上啟用 USB 調試和使用一個迷你 USB 電纜,將其插入您的系統。 + + [4]: http://developer.android.com/tools/device.html + +從命令列,可以將應用程式推送到設備: + + $ cordova run amazon-fireos + + +交替內日食,按右鍵該專案並選擇**作為 → 運行 Android 應用程式**. + +**注**: 目前,通過模擬程式測試不支援對於亞馬遜 web 視圖基於的應用程式。 http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.5.0/guide/platforms/amazonfireos/plugin.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.5.0/guide/platforms/amazonfireos/plugin.md b/www/docs/zh-cn/3.5.0/guide/platforms/amazonfireos/plugin.md new file mode 100644 index 0000000..0677f2a --- /dev/null +++ b/www/docs/zh-cn/3.5.0/guide/platforms/amazonfireos/plugin.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: 亞馬遜火 OS 外掛程式 +--- + +# 亞馬遜火 OS 外掛程式 + +按照有關的開發自訂外掛程式概述 Android 外掛程式指南中提供的說明。 + +## 回聲亞馬遜火 OS 外掛程式示例 + +若要匹配的 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."); + } + } + } + + +如果你想要重用的亞馬遜火 OS 平臺 Android 外掛程式代碼然後修改通過指向 `android` 特定的原始檔案。例如, + + + + + + + + + + + +如果你想要編寫自訂的外掛程式的亞馬遜火 OS 平臺,然後創建一個名為資料夾 `amazon` 下你的外掛程式 src / 資料夾和修改通過為指向 `amazon` 特定的原始檔案。 例如, + + + + + + + + + + + +## 在你的外掛程式中使用亞馬遜 web 視圖 + +科爾多瓦的亞馬遜火 OS 使得使用的基於開放源碼鉻專案的自訂亞馬遜 web 視圖。它是 GPU 加速和優化的流體性能上點燃火。 + +若要瞭解如何以最佳方式在您的專案中使用亞馬遜 web 視圖,查閱[亞馬遜開發人員門戶][1]. + + [1]: https://developer.amazon.com/sdk/fire/IntegratingAWV.html \ 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