summaryrefslogtreecommitdiff
path: root/StoneIsland/plugins/cordova-plugin-device/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/plugins/cordova-plugin-device/README.md')
-rw-r--r--[-rwxr-xr-x]StoneIsland/plugins/cordova-plugin-device/README.md221
1 files changed, 156 insertions, 65 deletions
diff --git a/StoneIsland/plugins/cordova-plugin-device/README.md b/StoneIsland/plugins/cordova-plugin-device/README.md
index d3d7673d..10b80160 100755..100644
--- a/StoneIsland/plugins/cordova-plugin-device/README.md
+++ b/StoneIsland/plugins/cordova-plugin-device/README.md
@@ -1,3 +1,7 @@
+---
+title: Device
+description: Get device information.
+---
<!--
# license: Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
@@ -17,17 +21,24 @@
# under the License.
-->
-# cordova-plugin-device
+|Android|iOS| Windows 8.1 Store | Windows 8.1 Phone | Windows 10 Store | Travis CI |
+|:-:|:-:|:-:|:-:|:-:|:-:|
+|[![Build Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=android,PLUGIN=cordova-plugin-device)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=android,PLUGIN=cordova-plugin-device/)|[![Build Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=ios,PLUGIN=cordova-plugin-device)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=ios,PLUGIN=cordova-plugin-device/)|[![Build Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=windows-8.1-store,PLUGIN=cordova-plugin-device)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=windows-8.1-store,PLUGIN=cordova-plugin-device/)|[![Build Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=windows-8.1-phone,PLUGIN=cordova-plugin-device)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=windows-8.1-phone,PLUGIN=cordova-plugin-device/)|[![Build Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=windows-10-store,PLUGIN=cordova-plugin-device)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=windows-10-store,PLUGIN=cordova-plugin-device/)|[![Build Status](https://travis-ci.org/apache/cordova-plugin-device.svg?branch=master)](https://travis-ci.org/apache/cordova-plugin-device)|
-[![Build Status](https://travis-ci.org/apache/cordova-plugin-device.svg?branch=master)](https://travis-ci.org/apache/cordova-plugin-device)
+# cordova-plugin-device
This plugin defines a global `device` object, which describes the device's hardware and software.
Although the object is in the global scope, it is not available until after the `deviceready` event.
- document.addEventListener("deviceready", onDeviceReady, false);
- function onDeviceReady() {
- console.log(device.cordova);
- }
+```js
+document.addEventListener("deviceready", onDeviceReady, false);
+function onDeviceReady() {
+ console.log(device.cordova);
+}
+```
+
+Report issues with this plugin on the [Apache Cordova issue tracker](https://issues.apache.org/jira/issues/?jql=project%20%3D%20CB%20AND%20status%20in%20%28Open%2C%20%22In%20Progress%22%2C%20Reopened%29%20AND%20resolution%20%3D%20Unresolved%20AND%20component%20%3D%20%22Plugin%20Device%22%20ORDER%20BY%20priority%20DESC%2C%20summary%20ASC%2C%20updatedDate%20DESC)
+
## Installation
@@ -40,6 +51,9 @@ Although the object is in the global scope, it is not available until after the
- device.platform
- device.uuid
- device.version
+- device.manufacturer
+- device.isVirtual
+- device.serial
## device.cordova
@@ -55,7 +69,8 @@ Get the version of Cordova running on the device.
- iOS
- Tizen
- Windows Phone 7 and 8
-- Windows 8
+- Windows
+- OSX
## device.model
@@ -71,18 +86,22 @@ different across versions of the same product.
- iOS
- Tizen
- Windows Phone 7 and 8
-- Windows 8
+- Windows
+- OSX
### Quick Example
- // 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. See http://theiphonewiki.com/wiki/index.php?title=Models
- //
- var model = device.model;
+```js
+// 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. See http://theiphonewiki.com/wiki/index.php?title=Models
+// OSX: returns "x86_64"
+//
+var model = device.model;
+```
### Android Quirks
@@ -100,30 +119,34 @@ different across versions of the same product.
Get the device's operating system name.
- var string = device.platform;
-
+```js
+var string = device.platform;
+```
### Supported Platforms
- Android
- BlackBerry 10
-- Browser4
+- Browser
- Firefox OS
- iOS
- Tizen
- Windows Phone 7 and 8
-- Windows 8
+- Windows
+- OSX
### Quick Example
- // 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;
+```js
+// Depending on the device, a few examples are:
+// - "Android"
+// - "BlackBerry 10"
+// - "browser"
+// - "iOS"
+// - "WinCE"
+// - "Tizen"
+// - "Mac OS X"
+var devicePlatform = device.platform;
+```
### Windows Phone 7 Quirks
@@ -137,7 +160,9 @@ Windows Phone 8 devices report the platform as `Win32NT`.
Get the device's Universally Unique Identifier ([UUID](http://en.wikipedia.org/wiki/Universally_Unique_Identifier)).
- var string = device.uuid;
+```js
+var string = device.uuid;
+```
### Description
@@ -150,33 +175,36 @@ The details of how a UUID is generated are determined by the device manufacturer
- iOS
- Tizen
- Windows Phone 7 and 8
-- Windows 8
+- Windows
+- OSX
### Quick Example
- // Android: Returns a random 64-bit integer (as a string, again!)
- // The integer is generated on the device's first boot
- //
- // BlackBerry: Returns the PIN number of the device
- // This is a nine-digit unique integer (as a string, though!)
- //
- // iPhone: (Paraphrased from the UIDevice Class documentation)
- // Returns a string of hash values created from multiple hardware identifies.
- // It is guaranteed to be unique for every device and can't be tied
- // to the user account.
- // Windows Phone 7 : Returns a hash of device+current user,
- // if the user is not defined, a guid is generated and will persist until the app is uninstalled
- // Tizen: returns the device IMEI (International Mobile Equipment Identity or IMEI is a number
- // unique to every GSM and UMTS mobile phone.
- var deviceID = device.uuid;
+```js
+// Android: Returns a random 64-bit integer (as a string, again!)
+// The integer is generated on the device's first boot
+//
+// BlackBerry: Returns the PIN number of the device
+// This is a nine-digit unique integer (as a string, though!)
+//
+// iPhone: (Paraphrased from the UIDevice Class documentation)
+// Returns the [UIDevice identifierForVendor] UUID which is unique and the same for all apps installed by the same vendor. However the UUID can be different if the user deletes all apps from the vendor and then reinstalls it.
+// Windows Phone 7 : Returns a hash of device+current user,
+// if the user is not defined, a guid is generated and will persist until the app is uninstalled
+// Tizen: returns the device IMEI (International Mobile Equipment Identity or IMEI is a number
+// unique to every GSM and UMTS mobile phone.
+var deviceID = device.uuid;
+```
### iOS Quirk
-The `uuid` on iOS is not unique to a device, but varies for each
-application, for each installation. It changes if you delete and
-re-install the app, and possibly also when you upgrade iOS, or even
-upgrade the app per version (apparent in iOS 5.1). The `uuid` is not
-a reliable value.
+The `uuid` on iOS uses the identifierForVendor property. It is unique to the device across the same vendor, but will be different for different vendors and will change if all apps from the vendor are deleted and then reinstalled.
+Refer [here](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIDevice_Class/#//apple_ref/occ/instp/UIDevice/identifierForVendor) for details.
+The UUID will be the same if app is restored from a backup or iCloud as it is saved in preferences. Users using older versions of this plugin will still receive the same previous UUID generated by another means as it will be retrieved from preferences.
+
+### OSX Quirk
+
+The `uuid` on OSX is generated automatically if it does not exist yet and is stored in the `standardUserDefaults` in the `CDVUUID` property.
### Windows Phone 7 and 8 Quirks
@@ -200,21 +228,84 @@ Get the operating system version.
- iOS
- Tizen
- Windows Phone 7 and 8
-- Windows 8
+- Windows
+- OSX
+
+### Quick Example
+
+```js
+// 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
+// Windows 8: return the current OS version, ex on Windows 8.1 returns 6.3.9600.16384
+// Tizen: returns "TIZEN_20120425_2"
+// OSX: El Capitan would return "10.11.2"
+//
+var deviceVersion = device.version;
+```
+
+## device.manufacturer
+
+Get the device's manufacturer.
+
+ var string = device.manufacturer;
+
+### Supported Platforms
+
+- Android
+- BlackBerry 10
+- iOS
+- Windows Phone 7 and 8
+- Windows
### Quick Example
- // 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;
+```js
+// Android: Motorola XT1032 would return "motorola"
+// BlackBerry: returns "BlackBerry"
+// iPhone: returns "Apple"
+//
+var deviceManufacturer = device.manufacturer;
+```
+
+## device.isVirtual
+
+whether the device is running on a simulator.
+
+```js
+var isSim = device.isVirtual;
+```
+
+### Supported Platforms
+
+- Android 2.1+
+- iOS
+- Windows Phone 8
+- Windows
+- OSX
+
+### OSX Quirk
+
+The `isVirtual` property on OS X always returns false.
+
+## device.serial
+
+Get the device hardware serial number ([SERIAL](http://developer.android.com/reference/android/os/Build.html#SERIAL)).
+
+```js
+var string = device.serial;
+```
+
+### Supported Platforms
+
+- Android
+- OSX