1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/Touchgui/plugins/org.apache.cordova.device/doc/zh/index.md Thu Jun 04 14:50:33 2015 +0200 1.3 @@ -0,0 +1,206 @@ 1.4 +<!--- 1.5 + Licensed to the Apache Software Foundation (ASF) under one 1.6 + or more contributor license agreements. See the NOTICE file 1.7 + distributed with this work for additional information 1.8 + regarding copyright ownership. The ASF licenses this file 1.9 + to you under the Apache License, Version 2.0 (the 1.10 + "License"); you may not use this file except in compliance 1.11 + with the License. You may obtain a copy of the License at 1.12 + 1.13 + http://www.apache.org/licenses/LICENSE-2.0 1.14 + 1.15 + Unless required by applicable law or agreed to in writing, 1.16 + software distributed under the License is distributed on an 1.17 + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1.18 + KIND, either express or implied. See the License for the 1.19 + specific language governing permissions and limitations 1.20 + under the License. 1.21 +--> 1.22 + 1.23 +# org.apache.cordova.device 1.24 + 1.25 +這個外掛程式定義全球 `device` 物件,描述該設備的硬體和軟體。 雖然物件是在全球範圍內,但不是可用,直到後 `deviceready` 事件。 1.26 + 1.27 + document.addEventListener("deviceready", onDeviceReady, false); 1.28 + function onDeviceReady() { 1.29 + console.log(device.cordova); 1.30 + } 1.31 + 1.32 + 1.33 +## 安裝 1.34 + 1.35 + cordova plugin add org.apache.cordova.device 1.36 + 1.37 + 1.38 +## 屬性 1.39 + 1.40 +* device.cordova 1.41 +* device.model 1.42 +* device.platform 1.43 +* device.uuid 1.44 +* device.version 1.45 + 1.46 +## device.cordova 1.47 + 1.48 +獲取科爾多瓦在設備上運行的版本。 1.49 + 1.50 +### 支援的平臺 1.51 + 1.52 +* 亞馬遜火 OS 1.53 +* Android 系統 1.54 +* 黑莓 10 1.55 +* 瀏覽器 1.56 +* 火狐瀏覽器的作業系統 1.57 +* iOS 1.58 +* 泰 1.59 +* Windows Phone 7 和 8 1.60 +* Windows 8 1.61 + 1.62 +## device.model 1.63 + 1.64 +`device.model`返回設備的模型或產品的名稱。值由設備製造商設置和同一產品的不同版本可能不同。 1.65 + 1.66 +### 支援的平臺 1.67 + 1.68 +* Android 系統 1.69 +* 黑莓 10 1.70 +* 瀏覽器 1.71 +* iOS 1.72 +* 泰 1.73 +* Windows Phone 7 和 8 1.74 +* Windows 8 1.75 + 1.76 +### 快速的示例 1.77 + 1.78 + // Android: Nexus One returns "Passion" (Nexus One code name) 1.79 + // Motorola Droid returns "voles" 1.80 + // BlackBerry: Torch 9800 returns "9800" 1.81 + // Browser: Google Chrome returns "Chrome" 1.82 + // Safari returns "Safari" 1.83 + // iOS: for the iPad Mini, returns iPad2,5; iPhone 5 is iPhone 5,1. 請參閱 HTTP://theiphonewiki.com/wiki/index.php?title=Models / / var 模型 = device.model ; 1.84 + 1.85 + 1.86 +### Android 的怪癖 1.87 + 1.88 +* 獲取[產品名稱][1]而不是[產品型號名稱][2],這往往是生產代碼名稱。 例如,Nexus One 返回 `Passion` ,和摩托羅拉 Droid 返回`voles`. 1.89 + 1.90 + [1]: http://developer.android.com/reference/android/os/Build.html#PRODUCT 1.91 + [2]: http://developer.android.com/reference/android/os/Build.html#MODEL 1.92 + 1.93 +### Tizen 怪癖 1.94 + 1.95 +* 例如,返回與供應商指派的設備模型`TIZEN` 1.96 + 1.97 +### Windows Phone 7 和 8 怪癖 1.98 + 1.99 +* 返回由製造商指定的設備模型。例如,三星焦點返回`SGH-i917`. 1.100 + 1.101 +## device.platform 1.102 + 1.103 +獲取設備的作業系統名稱。 1.104 + 1.105 + var string = device.platform; 1.106 + 1.107 + 1.108 +### 支援的平臺 1.109 + 1.110 +* Android 系統 1.111 +* 黑莓 10 1.112 +* Browser4 1.113 +* 火狐瀏覽器的作業系統 1.114 +* iOS 1.115 +* 泰 1.116 +* Windows Phone 7 和 8 1.117 +* Windows 8 1.118 + 1.119 +### 快速的示例 1.120 + 1.121 + // Depending on the device, a few examples are: 1.122 + // - "Android" 1.123 + // - "BlackBerry 10" 1.124 + // - Browser: returns "MacIntel" on Mac 1.125 + // returns "Win32" on Windows 1.126 + // - "iOS" 1.127 + // - "WinCE" 1.128 + // - "Tizen" 1.129 + var devicePlatform = device.platform; 1.130 + 1.131 + 1.132 +### Windows Phone 7 的怪癖 1.133 + 1.134 +Windows Phone 7 設備報告作為平臺`WinCE`. 1.135 + 1.136 +### Windows Phone 8 怪癖 1.137 + 1.138 +Windows Phone 8 設備報告作為平臺`Win32NT`. 1.139 + 1.140 +## device.uuid 1.141 + 1.142 +獲取設備的通用唯一識別碼 ([UUID][3]). 1.143 + 1.144 + [3]: http://en.wikipedia.org/wiki/Universally_Unique_Identifier 1.145 + 1.146 + var string = device.uuid; 1.147 + 1.148 + 1.149 +### 說明 1.150 + 1.151 +如何生成一個 UUID 的細節由設備製造商和特定于設備的平臺或模型。 1.152 + 1.153 +### 支援的平臺 1.154 + 1.155 +* Android 系統 1.156 +* 黑莓 10 1.157 +* iOS 1.158 +* Tizen 1.159 +* Windows Phone 7 和 8 1.160 +* Windows 8 1.161 + 1.162 +### 快速的示例 1.163 + 1.164 + / / Android: 一個隨機的 64 位整數 (作為字串返回,再次!) / / 上設備的第一次啟動生成的整數 / / / / 黑莓手機: 返回設備的 PIN 號碼 / / 這是九個數字的唯一整數 (作為字串,雖然!) / / / / iPhone: (從 UIDevice 類文檔解釋) / / 返回一個字串的雜湊值創建的多個硬體標識。 1.165 + / / 它保證是唯一的每個設備並不能綁 / / 到使用者帳戶。 1.166 + / / Windows Phone 7: 返回的雜湊代碼的設備 + 當前使用者,/ / 如果未定義使用者,則一個 guid 生成的並且將會保留直到卸載該應用程式 / / Tizen: 返回設備 IMEI (國際行動裝置身份或 IMEI 是一個數位 / / 獨有的每一個 UMTS 和 GSM 行動電話。 1.167 + var deviceID = device.uuid; 1.168 + 1.169 + 1.170 +### iOS 怪癖 1.171 + 1.172 +`uuid`在 iOS 不是唯一的一種裝置,但對於每個應用程式,為每個安裝而異。 如果您刪除並重新安裝該應用程式,它更改和可能還當你升級 iOS,或甚至升級每個版本 (iOS 5.1 中存在明顯的) 的應用程式。 `uuid`不是一個可靠的值。 1.173 + 1.174 +### Windows Phone 7 和 8 怪癖 1.175 + 1.176 +`uuid`為 Windows Phone 7 須經許可 `ID_CAP_IDENTITY_DEVICE` 。 Microsoft 可能會很快棄用此屬性。 如果沒有可用的能力,應用程式將生成設備上應用程式的安裝過程中保持持續的 guid。 1.177 + 1.178 +## device.version 1.179 + 1.180 +獲取作業系統版本。 1.181 + 1.182 + var string = device.version; 1.183 + 1.184 + 1.185 +### 支援的平臺 1.186 + 1.187 +* Android 2.1 + 1.188 +* 黑莓 10 1.189 +* 瀏覽器 1.190 +* iOS 1.191 +* 泰 1.192 +* Windows Phone 7 和 8 1.193 +* Windows 8 1.194 + 1.195 +### 快速的示例 1.196 + 1.197 + // Android: Froyo OS would return "2.2" 1.198 + // Eclair OS would return "2.1", "2.0.1", or "2.0" 1.199 + // Version can also return update level "2.1-update1" 1.200 + // 1.201 + // BlackBerry: Torch 9800 using OS 6.0 would return "6.0.0.600" 1.202 + // 1.203 + // Browser: Returns version number for the browser 1.204 + // 1.205 + // iPhone: iOS 3.2 returns "3.2" 1.206 + // 1.207 + // Windows Phone 7: returns current OS version number, ex. on Mango returns 7.10.7720 1.208 + // Tizen: returns "TIZEN_20120425_2" 1.209 + var deviceVersion = device.version; 1.210 \ No newline at end of file