Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
15747 anikendra 1
<!---
2
    Licensed to the Apache Software Foundation (ASF) under one
3
    or more contributor license agreements.  See the NOTICE file
4
    distributed with this work for additional information
5
    regarding copyright ownership.  The ASF licenses this file
6
    to you under the Apache License, Version 2.0 (the
7
    "License"); you may not use this file except in compliance
8
    with the License.  You may obtain a copy of the License at
9
 
10
      http://www.apache.org/licenses/LICENSE-2.0
11
 
12
    Unless required by applicable law or agreed to in writing,
13
    software distributed under the License is distributed on an
14
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
    KIND, either express or implied.  See the License for the
16
    specific language governing permissions and limitations
17
    under the License.
18
-->
19
 
20
# org.apache.cordova.device
21
 
22
このプラグインをグローバル定義します `device` オブジェクトは、デバイスのハードウェアとソフトウェアについて説明します。 それは後まで利用可能なオブジェクトがグローバル スコープでは、 `deviceready` イベント。
23
 
24
    document.addEventListener("deviceready", onDeviceReady, false);
25
    function onDeviceReady() {
26
        console.log(device.cordova);
27
    }
28
 
29
 
30
## インストール
31
 
32
    cordova plugin add org.apache.cordova.device
33
 
34
 
35
## プロパティ
36
 
37
*   device.cordova
38
*   device.model
39
*   device.platform
40
*   device.uuid
41
*   device.version
42
 
43
## device.cordova
44
 
45
デバイスで実行されているコルドバのバージョンを取得します。
46
 
47
### サポートされているプラットフォーム
48
 
49
*   アマゾン火 OS
50
*   アンドロイド
51
*   ブラックベリー 10
52
*   ブラウザー
53
*   Firefox の OS
54
*   iOS
55
*   Tizen
56
*   Windows Phone 7 と 8
57
*   Windows 8
58
 
59
## device.model
60
 
61
`device.model`、デバイスのモデルまたは製品の名前を返します。値は、デバイスの製造元によって設定され、同じ製品のバージョン間で異なる可能性があります。
62
 
63
### サポートされているプラットフォーム
64
 
65
*   アンドロイド
66
*   ブラックベリー 10
67
*   ブラウザー
68
*   iOS
69
*   Tizen
70
*   Windows Phone 7 と 8
71
*   Windows 8
72
 
73
### 簡単な例
74
 
75
    // Android:    Nexus One       returns "Passion" (Nexus One code name)
76
    //             Motorola Droid  returns "voles"
77
    // BlackBerry: Torch 9800      returns "9800"
78
    // Browser:    Google Chrome   returns "Chrome"
79
    //             Safari          returns "Safari"
80
    // 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;
81
 
82
 
83
### Android の癖
84
 
85
*   生産コード名は[モデル名][1]の代わりに[製品名][2]を取得します。 たとえば、ネクサス 1 つを返します `Passion` 、Motorola のドロイドを返します`voles`.
86
 
87
 [1]: http://developer.android.com/reference/android/os/Build.html#MODEL
88
 [2]: http://developer.android.com/reference/android/os/Build.html#PRODUCT
89
 
90
### Tizen の癖
91
 
92
*   たとえば、ベンダーによって割り当てられているデバイスのモデルを返します`TIZEN`
93
 
94
### Windows Phone 7 と 8 癖
95
 
96
*   製造元によって指定されたデバイスのモデルを返します。たとえば、三星フォーカスを返します`SGH-i917`.
97
 
98
## device.platform
99
 
100
デバイスのオペレーティング システム名を取得します。
101
 
102
    var string = device.platform;
103
 
104
 
105
### サポートされているプラットフォーム
106
 
107
*   アンドロイド
108
*   ブラックベリー 10
109
*   Browser4
110
*   Firefox の OS
111
*   iOS
112
*   Tizen
113
*   Windows Phone 7 と 8
114
*   Windows 8
115
 
116
### 簡単な例
117
 
118
    // Depending on the device, a few examples are:
119
    //   - "Android"
120
    //   - "BlackBerry 10"
121
    //   - Browser:         returns "MacIntel" on Mac
122
    //                      returns "Win32" on Windows
123
    //   - "iOS"
124
    //   - "WinCE"
125
    //   - "Tizen"
126
    var devicePlatform = device.platform;
127
 
128
 
129
### Windows Phone 7 の癖
130
 
131
Windows Phone 7 デバイスとプラットフォームを報告します。`WinCE`.
132
 
133
### Windows Phone 8 癖
134
 
135
Windows Phone 8 デバイスとプラットフォームを報告します。`Win32NT`.
136
 
137
## device.uuid
138
 
139
デバイスのユニバーサル ・ ユニーク識別子 ([UUID][3]を取得します。).
140
 
141
 [3]: http://en.wikipedia.org/wiki/Universally_Unique_Identifier
142
 
143
    var string = device.uuid;
144
 
145
 
146
### 説明
147
 
148
UUID を生成する方法の詳細は、デバイスの製造元によって決定され、デバイスのプラットフォームやモデルに固有です。
149
 
150
### サポートされているプラットフォーム
151
 
152
*   アンドロイド
153
*   ブラックベリー 10
154
*   iOS
155
*   Tizen
156
*   Windows Phone 7 と 8
157
*   Windows 8
158
 
159
### 簡単な例
160
 
161
    //アンドロイド: ランダムな 64 ビットの整数 (を文字列として返します、再び !)/デバイスの最初の起動時に生成される整数/////ブラックベリー: デバイスのピン番号を返します//これは 9 桁の一意な整数 (を文字列としても !)////iPhone: (UIDevice クラスのドキュメントから言い換え)//識別複数のハードウェアから作成されたハッシュ値の文字列を返します。。
162
    //それはすべてのデバイスに対して一意であることが保証され、接続することはできません//ユーザー アカウント。
163
    //Windows Phone 7: デバイス + 現在のユーザーのハッシュを返します//ユーザーが定義されていない場合 guid が生成され、アプリがアンインストールされるまで保持されます//Tizen: デバイスの IMEI を返します (国際モバイル機器アイデンティティまたは IMEI は番号です//すべての GSM および UMTS の携帯電話に固有です。
164
    var deviceID = device.uuid;
165
 
166
 
167
### iOS の気まぐれ
168
 
169
`uuid`IOS で、デバイスに固有ではないインストールごと、アプリケーションごとに異なります。 削除、アプリを再インストールした場合に変更と多分またときアップグレード iOS の, またはもアップグレードするアプリ (iOS の 5.1 で明らかに) バージョンごと。 `uuid`は信頼性の高い値ではありません。
170
 
171
### Windows Phone 7 と 8 癖
172
 
173
`uuid`のために Windows Phone 7 には、権限が必要です `ID_CAP_IDENTITY_DEVICE` 。 Microsoft はすぐにこのプロパティを廃止して可能性があります。 機能が利用できない場合、アプリケーションはデバイスへのアプリケーションのインストールの持続期間のために保持されている永続的な guid を生成します。
174
 
175
## device.version
176
 
177
オペレーティング システムのバージョンを取得します。
178
 
179
    var string = device.version;
180
 
181
 
182
### サポートされているプラットフォーム
183
 
184
*   アンドロイド 2.1 +
185
*   ブラックベリー 10
186
*   ブラウザー
187
*   iOS
188
*   Tizen
189
*   Windows Phone 7 と 8
190
*   Windows 8
191
 
192
### 簡単な例
193
 
194
    // Android:    Froyo OS would return "2.2"
195
    //             Eclair OS would return "2.1", "2.0.1", or "2.0"
196
    //             Version can also return update level "2.1-update1"
197
    //
198
    // BlackBerry: Torch 9800 using OS 6.0 would return "6.0.0.600"
199
    //
200
    // Browser:    Returns version number for the browser
201
    //
202
    // iPhone:     iOS 3.2 returns "3.2"
203
    //
204
    // Windows Phone 7: returns current OS version number, ex. on Mango returns 7.10.7720
205
    // Tizen: returns "TIZEN_20120425_2"
206
    var deviceVersion = device.version;