You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2012/12/11 00:02:57 UTC

docs commit: [CB-1981] Update Device API docs for device.model (for most platforms, this is what device.name was)

Updated Branches:
  refs/heads/master 5faa71681 -> 89943d567


[CB-1981] Update Device API docs for device.model (for most platforms, this is what device.name was)


Project: http://git-wip-us.apache.org/repos/asf/cordova-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-docs/commit/89943d56
Tree: http://git-wip-us.apache.org/repos/asf/cordova-docs/tree/89943d56
Diff: http://git-wip-us.apache.org/repos/asf/cordova-docs/diff/89943d56

Branch: refs/heads/master
Commit: 89943d567dbdaff81d7463c51a930e0432300a14
Parents: 5faa716
Author: Shazron Abdullah <sh...@apache.org>
Authored: Mon Dec 10 15:02:52 2012 -0800
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Mon Dec 10 15:02:52 2012 -0800

----------------------------------------------------------------------
 docs/en/edge/cordova/device/device.md       |    1 +
 docs/en/edge/cordova/device/device.model.md |  108 ++++++++++++++++++++++
 docs/en/edge/cordova/device/device.name.md  |    3 +-
 3 files changed, 111 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/89943d56/docs/en/edge/cordova/device/device.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/device/device.md b/docs/en/edge/cordova/device/device.md
index 9c43225..294cb42 100644
--- a/docs/en/edge/cordova/device/device.md
+++ b/docs/en/edge/cordova/device/device.md
@@ -30,6 +30,7 @@ Properties
 - device.platform
 - device.uuid
 - device.version
+- device.model
 
 Variable Scope
 --------------

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/89943d56/docs/en/edge/cordova/device/device.model.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/device/device.model.md b/docs/en/edge/cordova/device/device.model.md
new file mode 100644
index 0000000..842d78f
--- /dev/null
+++ b/docs/en/edge/cordova/device/device.model.md
@@ -0,0 +1,108 @@
+---
+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.
+---
+
+device.model
+===========
+
+Get the device's model name.
+
+    var string = device.model;
+    
+Description
+-----------
+
+`device.model` returns the name of the device's model or product. This value is set by the device manufacturer and may be different across versions of the same product.
+
+Supported Platforms
+-------------------
+
+- Android
+- BlackBerry WebWorks (OS 5.0 and higher)
+- iOS
+- Windows Phone 7 and 8
+- Bada 1.2 & 2.x
+- webOS
+- Tizen
+- Windows 8
+
+Quick Example
+-------------
+
+    // Android:    Nexus One       returns "Passion" (Nexus One code name)
+    //             Motorola Droid  returns "voles"
+    // BlackBerry: Torch 9800      returns "9800"
+    // iOS:     for the iPad Mini, will return iPad2,5. iPhone 5 is iPhone 5,1. See http://theiphonewiki.com/wiki/index.php?title=Models
+    //
+    var model = device.model;
+
+Full Example
+------------
+
+    <!DOCTYPE html>
+    <html>
+      <head>
+        <title>Device Properties Example</title>
+
+        <script type="text/javascript" charset="utf-8" src="cordova-2.3.0.js"></script>
+        <script type="text/javascript" charset="utf-8">
+
+        // Wait for Cordova to load
+        //
+        document.addEventListener("deviceready", onDeviceReady, false);
+
+        // Cordova is ready
+        //
+        function onDeviceReady() {
+            var element = document.getElementById('deviceProperties');
+    
+            element.innerHTML = 'Device Name: '     + device.name     + '<br />' + 
+                                'Device Cordova: '  + device.cordova + '<br />' + 
+                                'Device Platform: ' + device.platform + '<br />' + 
+                                'Device UUID: '     + device.uuid     + '<br />' + 
+                                'Device Model: '    + device.model     + '<br />' + 
+                                'Device Version: '  + device.version  + '<br />';
+        }
+
+        </script>
+      </head>
+      <body>
+        <p id="deviceProperties">Loading device properties...</p>
+      </body>
+    </html>
+
+
+Android Quirks
+--------------
+
+- Gets the [product name](http://developer.android.com/reference/android/os/Build.html#PRODUCT) instead of the [model name](http://developer.android.com/reference/android/os/Build.html#MODEL).
+    - The product name is often the code name given during production.
+    - e.g. Nexus One returns "Passion", Motorola Droid returns "voles"
+
+Windows Phone 7 and 8 Quirks
+-------------
+
+- returns the manufacturer specified device model, for example, the Samsung Focus returns 'SGH-i917'
+
+Bada Quirks
+-----------
+- returns the manufacturer model name. For example 'Samsung Wave S8500'
+
+Tizen Quirks
+-----------
+- returns the device model assigned by the vendor. For example 'TIZEN'

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/89943d56/docs/en/edge/cordova/device/device.name.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/device/device.name.md b/docs/en/edge/cordova/device/device.name.md
index a274a36..7447775 100644
--- a/docs/en/edge/cordova/device/device.name.md
+++ b/docs/en/edge/cordova/device/device.name.md
@@ -19,7 +19,7 @@ license: Licensed to the Apache Software Foundation (ASF) under one
 
 device.name
 ===========
-WARNING: device.name is deprecated as of version 2.3.0
+WARNING: device.name is deprecated as of version 2.3.0, use device.model instead
 
 Get the device's model name.
 
@@ -76,6 +76,7 @@ Full Example
                                 'Device Cordova: '  + device.cordova + '<br />' + 
                                 'Device Platform: ' + device.platform + '<br />' + 
                                 'Device UUID: '     + device.uuid     + '<br />' + 
+                                'Device Model: '    + device.model     + '<br />' + 
                                 'Device Version: '  + device.version  + '<br />';
         }