<!-- # 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. --> # cordova-plugin-device [](https://travis-ci.org/apache/cordova-plugin-device) ì´ í”ŒëŸ¬ê·¸ì¸ ì •ì˜ ì „ì— `device` 개체, 디바ì´ìŠ¤ì˜ 하드웨어 ë° ì†Œí”„íŠ¸ì›¨ì–´ì— ì„¤ëª… 합니다. 개체는 ì „ì— ë²”ìœ„ì—ì„œ ë¹„ë¡ ê·¸ê²ƒì€ í›„ê¹Œì§€ ì‚¬ìš©í• ìˆ˜ 있는 `deviceready` ì´ë²¤íŠ¸. document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { console.log(device.cordova); } ## 설치 cordova plugin add cordova-plugin-device ## ì†ì„± * device.cordova * device.model * device.platform * device.uuid * device.version ## device.cordova 코르ë„바는 장치ì—ì„œ 실행 ì¤‘ì¸ ë²„ì „ì„ ì–»ì„. ### ì§€ì› ë˜ëŠ” í”Œëž«í¼ * 아마존 화재 ìš´ì˜ ì²´ì œ * 안 ë“œ ë¡œì´ë“œ * ë¸”ëž™ë² ë¦¬ 10 * 브ë¼ìš°ì € * Firefox ìš´ì˜ ì²´ì œ * iOS * Tizen * Windows Phone 7ê³¼ 8 * 윈ë„ìš° 8 ## device.model `device.model`소ìžì˜ ëª¨ë¸ ë˜ëŠ” ì œí’ˆì˜ ì´ë¦„ì„ ë°˜í™˜ 합니다. ê°’ 장치 ì œì¡°ì—…ì²´ì—ì„œ ì„¤ì • ë˜ ê³ ë™ì¼ ì œí’ˆì˜ ë²„ì „ ê°„ì— ë‹¤ë¥¼ 수 있습니다. ### ì§€ì› ë˜ëŠ” í”Œëž«í¼ * 안 ë“œ ë¡œì´ë“œ * ë¸”ëž™ë² ë¦¬ 10 * 브ë¼ìš°ì € * iOS * Tizen * Windows Phone 7ê³¼ 8 * 윈ë„ìš° 8 ### ë¹ ë¥¸ ì˜ˆì œ // Android: Nexus One returns "Passion" (Nexus One code name) // Motorola Droid returns "voles" // BlackBerry: Torch 9800 returns "9800" // Browser: Google Chrome returns "Chrome" // Safari returns "Safari" // 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; ### 안 ë“œ ë¡œì´ë“œ 단ì * ì–´ë–¤ì€ ì¢…ì¢… 프로ë•ì…˜ 코드 ì´ë¦„ ëŒ€ì‹ [ì œí’ˆ ëª¨ë¸ ì´ë¦„](http://developer.android.com/reference/android/os/Build.html#MODEL), [ì œí’ˆ ì´ë¦„](http://developer.android.com/reference/android/os/Build.html#PRODUCT) ì„ ê°€ì ¸ì˜µë‹ˆë‹¤. 예를 들어 넥서스 하나 반환 합니다 `Passion` , ëª¨í† ë¡œë¼ Droid를 반환 합니다`voles`. ### Tizen 특수 * 예를 들어, 공급 ì—…ì²´ì— ì˜í•´ í• ë‹¹ ëœ ë””ë°”ì´ìŠ¤ 모ë¸ì„ 반환 합니다.`TIZEN` ### Windows Phone 7, 8 특수 * ì œì¡°ì—…ì²´ì—ì„œ ì§€ì • 하는 장치 모ë¸ì„ 반환 합니다. 예를 들어 삼성 í¬ì»¤ìŠ¤ë¥¼ 반환 합니다.`SGH-i917`. ## device.platform ìž¥ì¹˜ì˜ ìš´ì˜ ì²´ì œ ì´ë¦„ì„ ì–»ì„. var string = device.platform; ### ì§€ì› ë˜ëŠ” í”Œëž«í¼ * 안 ë“œ ë¡œì´ë“œ * ë¸”ëž™ë² ë¦¬ 10 * Browser4 * Firefox ìš´ì˜ ì²´ì œ * iOS * Tizen * Windows Phone 7ê³¼ 8 * 윈ë„ìš° 8 ### ë¹ ë¥¸ ì˜ˆì œ // Depending on the device, a few examples are: // - "Android" // - "BlackBerry 10" // - Browser: returns "MacIntel" on Mac // returns "Win32" on Windows // - "iOS" // - "WinCE" // - "Tizen" var devicePlatform = device.platform; ### Windows Phone 7 단ì Windows Phone 7 장치 ë³´ê³ í”Œëž«í¼ìœ¼ë¡œ`WinCE`. ### Windows Phone 8 단ì Windows Phone 8 장치 ë³´ê³ í”Œëž«í¼ìœ¼ë¡œ`Win32NT`. ## device.uuid 소ìžì˜ 보편ì 으로 ê³ ìœ ì‹ë³„ìž ([UUID](http://en.wikipedia.org/wiki/Universally_Unique_Identifier) 를 ì–»ì„합니다). var string = device.uuid; ### 설명 UUID ìƒì„± ë°©ë²•ì˜ ìžì„¸í•œ ë‚´ìš©ì€ ìž¥ì¹˜ ì œì¡°ì—…ì²´ì— ì˜í•´ ê²°ì • ë©ë‹ˆë‹¤ ë° ì†Œìžì˜ í”Œëž«í¼ ì´ë‚˜ 모ë¸. ### ì§€ì› ë˜ëŠ” í”Œëž«í¼ * 안 ë“œ ë¡œì´ë“œ * ë¸”ëž™ë² ë¦¬ 10 * iOS * Tizen * Windows Phone 7ê³¼ 8 * 윈ë„ìš° 8 ### ë¹ ë¥¸ ì˜ˆì œ / / 안 ë“œ ë¡œì´ë“œ: (문ìžì—´ë¡œ 다시!) ìž„ì˜ì˜ 64 비트 ì •ìˆ˜ë¥¼ 반환 합니다 / / ì •ìˆ˜ ìž¥ì¹˜ì˜ ì²« 번째 부팅ì—ì„œ ìƒì„± / / / / ë¸”ëž™ë² ë¦¬: 디바ì´ìŠ¤ì˜ í•€ 번호를 반환 합니다 / / ì´ê²ƒì€ 9 ìžë¦¬ ê³ ìœ ì •ìˆ˜ (문ìžì—´ë¡œ 비ë¡!) / / / / ì•„ì´í°: (UIDevice í´ëž˜ìŠ¤ 설명서ì—ì„œ ìŠ ì—ˆ) / / 문ìžì—´ 여러 하드웨어ì—ì„œ ìƒì„± 하는 í•´ì‹œ ê°’ì„ ì‹ë³„ 하는 반환 합니다. / ê·¸ê²ƒì€ ëª¨ë“ ìž¥ì¹˜ì— ëŒ€ í•œ ê³ ìœ í•´ì•¼ 보장 ë˜ ê³ ë¬¶ì¼ ìˆ˜ 없습니다 / / / ì‚¬ìš©ìž ê³„ì •ì—. / / Windows Phone 7: 장치 + 현재 사용ìžì˜ 해시를 반환 합니다 / / ì‚¬ìš©ìž ì •ì˜ ë˜ì§€ ì•Šì€ ê²½ìš° guid ìƒì„± ë˜ ê³ ì‘ìš© í”„ë¡œê·¸ëž¨ì„ ì œê±°í• ë•Œê¹Œì§€ ìœ ì§€ ë©ë‹ˆë‹¤ / / Tizen: 반환 장치 IMEI (êµì œ ëª¨ë°”ì¼ ê¸°ê¸° ì‹ë³„ ë˜ëŠ” IMEI 숫ìžìž…니다 / / ëª¨ë“ GSM와 UMTS 휴대 ì „í™” ê³ ìœ . var deviceID = device.uuid; ### iOS 특질 `uuid`ios ìž¥ì¹˜ì— ê³ ìœ í•˜ì§€ 않습니다 하지만 ê° ì„¤ì¹˜ì— ëŒ€ í•œ ì‘ìš© 프로그램 마다 다릅니다. ì‚ì œ 하 ê³ ë‹¤ì‹œ ì• í”Œ 리 ì¼€ì´ ì…˜ì„ ì„¤ì¹˜ 하는 경우 변경 가능 하 게 ë˜í•œ iOS를 ì—…ê·¸ë ˆì´ë“œ 하거나 ë•Œ ë²„ì „ (iOS 5.1ì—ì—ì„œ 명백한) 당 ì‘ìš© 프로그램 ì—…ê·¸ë ˆì´ë“œë„ 하 ê³ . `uuid`ì€ ì‹ ë¢°í• ìˆ˜ 있는 ê°’ì´ ì•„ë‹™ë‹ˆë‹¤. ### Windows Phone 7, 8 특수 `uuid`Windows Phone 7 í•„ìš” 허가 `ID_CAP_IDENTITY_DEVICE` . Microsoft는 ê³§ì´ ì†ì„±ì„ 세ì›ë‹ˆë‹¤ ê°€ëŠ¥ì„±ì´ ê²ƒìž…ë‹ˆë‹¤. ê¸°ëŠ¥ì„ ì‚¬ìš©í• ìˆ˜ 없는 경우 ì‘ìš© 프로그램 ìž¥ì¹˜ì— ì‘ìš© í”„ë¡œê·¸ëž¨ì˜ ì„¤ì¹˜ 하는 ë™ì•ˆ ìœ ì§€ 하는 ì˜êµ¬ guid를 ìƒì„± 합니다. ## device.version ìš´ì˜ ì²´ì œ ë²„ì „ì„ ì–»ì„. var string = device.version; ### ì§€ì› ë˜ëŠ” í”Œëž«í¼ * 안 ë“œ ë¡œì´ë“œ 2.1 + * ë¸”ëž™ë² ë¦¬ 10 * 브ë¼ìš°ì € * iOS * Tizen * Windows Phone 7ê³¼ 8 * 윈ë„ìš° 8 ### ë¹ ë¥¸ ì˜ˆì œ // Android: Froyo OS would return "2.2" // Eclair OS would return "2.1", "2.0.1", or "2.0" // Version can also return update level "2.1-update1" // // BlackBerry: Torch 9800 using OS 6.0 would return "6.0.0.600" // // Browser: Returns version number for the browser // // iPhone: iOS 3.2 returns "3.2" // // Windows Phone 7: returns current OS version number, ex. on Mango returns 7.10.7720 // Tizen: returns "TIZEN_20120425_2" var deviceVersion = device.version;