Cordova tutorials and guide: Device
authorJakub Skowron <j.skowron@samsung.com>
Wed, 11 May 2016 13:27:19 +0000 (15:27 +0200)
committerLukasz Bardeli <l.bardeli@samsung.com>
Tue, 28 Jun 2016 08:01:55 +0000 (10:01 +0200)
Change-Id: I05d52c500a7df615549a9954c7260f3538fbd960
Signed-off-by: Jakub Skowron <j.skowron@samsung.com>
org.tizen.guides/html/index.htm
org.tizen.guides/html/web/tizen/cordova/cordova_guide_w.htm
org.tizen.guides/html/web/tizen/cordova/device_w.htm [new file with mode: 0644]
org.tizen.tutorials/html/index.htm
org.tizen.tutorials/html/web/tizen/cordova/cordova_tutorials_w.htm
org.tizen.tutorials/html/web/tizen/cordova/device_tutorial_w.htm [new file with mode: 0644]

index 96742b2..ce55f69 100644 (file)
                                <li><a href="web/tizen/localization/localization_w.htm">Localization</a></li>
                                <li><a href="web/tizen/service/service_w.htm">Service Application</a></li>
                                <li><a href="web/tizen/ime/ime_w.htm">IME Application</a></li>
+                               <li><a href="web/tizen/cordova/cordova_guide_w.htm">Cordova</a>
+                                       <ul>
+                                               <li><a href="web/tizen/cordova/console_w.htm">Console</a></li>
+                                               <li><a href="web/tizen/cordova/device_w.htm">Device</a></li>
+                                       </ul>
+                               </li>
             </ul>
                </li>
                <li><a href="web/w3c/guides_w3c_w.htm">W3C/HTML5/Supplementary Features</a>
index cd5f4e6..854919a 100644 (file)
@@ -37,6 +37,7 @@
   <p>The main features are:</p>
   <ul>
     <li><a href="console_w.htm">Console</a><p>Write information to system console. It includes timing operations and object dump.</p></li>
+    <li><a href="device_w.htm">Device</a><p>Information on model, platform and installed version of Cordova.</p></li>
   </ul>
 
 
diff --git a/org.tizen.guides/html/web/tizen/cordova/device_w.htm b/org.tizen.guides/html/web/tizen/cordova/device_w.htm
new file mode 100644 (file)
index 0000000..95c4bbc
--- /dev/null
@@ -0,0 +1,102 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+    <meta http-equiv="X-UA-Compatible" content="IE=9" />
+    <link rel="stylesheet" type="text/css" href="../../../css/styles.css" />
+    <link rel="stylesheet" type="text/css" href="../../../css/snippet.css" />
+    <script type="text/javascript" src="../../../scripts/snippet.js"></script>
+    <script type="text/javascript" src="../../../scripts/jquery.util.js" charset="utf-8"></script>
+    <script type="text/javascript" src="../../../scripts/common.js" charset="utf-8"></script>
+    <script type="text/javascript" src="../../../scripts/core.js" charset="utf-8"></script>
+    <script type="text/javascript" src="../../../scripts/search.js" charset="utf-8"></script>
+  <title>Device</title>
+ </head>
+ <body onload="prettyPrint()" style="overflow: auto;">
+
+ <div id="toc-navigation">
+    <div id="profile">
+        <p><img alt="Mobile Web" src="../../../images/mobile_s_w.png"/> <img alt="Wearable Web" src="../../../images/wearable_s_w.png"/></p>
+    </div>
+
+    <div id="toc_border"><div id="toc">
+        <p class="toc-title">Related Info</p>
+        <ul class="toc">
+            <li><a href="../../../../../org.tizen.tutorials/html/web/tizen/cordova/device_tutorial_w.htm">Device Tutorial</a></li>
+            <li><a href="../../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/device.html">Device API for Mobile Web</a></li>
+            <li><a href="../../../../../org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/device.html">Device API for Wearable Web</a></li>
+            <li><a href="../../../../../org.tizen.web.apireference/html/device_api/tv/tizen/cordova/device.html">Device API for TV Web</a></li>
+            </ul>
+    </div></div>
+</div>
+
+<div id="container"><div id="contents"><div class="content">
+  <h1>Device</h1>
+
+
+<p>Defines a global dictionary <span style="font-family: monospace">device</span>, which describes device's hardware UUID (unique ID) and software version.</p>
+
+<table class="note">
+    <tbody>
+    <tr>
+        <th class="note">Note</th>
+    </tr>
+    <tr>
+        <td class="note">Wait for <span style="font-family: monospace">deviceready</span> event before using this object.</td>
+    </tr>
+    </tbody>
+</table>
+
+<h2>Properties</h2>
+<p>Following properties are aviailable in global object <span style="font-family: monospace">device</span>, for example:</p>
+<pre class="pretty-print">console.log( "Model name: " + device.model );</pre>
+<table id="interface">
+<caption>
+ Table: Device properties
+</caption>
+<tbody>
+    <tr>
+     <th>Property</th>
+     <th>Description</th>
+    </tr>
+    <tr>
+        <td>cordova</td><td>Version of Cordova running on the device (as a string). Example: <span style="font-family: monospace">5.1.1</span></td>
+    </tr>
+    <tr>
+        <td>model</td><td>Name of the device's model name. May be production code name.</td>
+    </tr>
+    <tr>
+        <td>platform</td><td>Operating system name. Example: <span style="font-family: monospace">Tizen</span></td>
+    </tr>
+    <tr>
+        <td>uuid</td><td>Device's Universally Unique Identifier (UUID). May be the device IMEI (International Mobile Equipment Identity) or other unique value for the device. Converted to string.</td>
+    </tr>
+    <tr>
+        <td>version</td><td>Operating system version (as a string). Example: <span style="font-family: monospace">3.0</span></td>
+    </tr>
+</tbody>
+</table>
+
+<script type="text/javascript" src="../../../scripts/jquery.zclip.min.js"></script>
+<script type="text/javascript" src="../../../scripts/showhide.js"></script>
+</div></div></div>
+
+<a class="top sms" href="#"><img src="../../../images/btn_top.gif" alt="Go to top" /></a>
+
+<div id="footer">
+<p class="footer">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br/>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</p>
+</div>
+
+<script type="text/javascript">
+var _gaq = _gaq || [];
+_gaq.push(['_setAccount', 'UA-25976949-1']);
+_gaq.push(['_trackPageview']);
+(function() {
+var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+})();
+</script>
+
+</body>
+</html>
index 89fcc03..1f40353 100644 (file)
                <li><a href="web/tizen/cordova/cordova_tutorials_w.htm">Cordova</a>
                        <ul>
                                <li><a href="web/tizen/cordova/console_tutorial_w.htm">Console</a></li>
+                               <li><a href="web/tizen/cordova/device_tutorial_w.htm">Device</a></li>
                        </ul>
                </li>
 
index e1bee0f..4990342 100644 (file)
 
   <p>Tutorials demonstrate how to use the following features in creating Tizen Web applications:</p>
   <ul>
-    <li><a href="console_tutorial_w.htm">Console: writing messages to system console</a><p>Demonstrates how you can log information for debugging purposes.</p></li>
+    <li><a href="console_tutorial_w.htm">Console: writing messages to system console</a>
+        <p>Demonstrates how you can log information for debugging purposes.</p></li>
+    <li><a href="device_tutorial_w.htm">Device: device's hardware and software versions</a>
+        <p>Demonstrates how you can get information on model, platform and installed version of Cordova.</p></li>
   </ul>
 
 <table class="note">
diff --git a/org.tizen.tutorials/html/web/tizen/cordova/device_tutorial_w.htm b/org.tizen.tutorials/html/web/tizen/cordova/device_tutorial_w.htm
new file mode 100644 (file)
index 0000000..572cdc9
--- /dev/null
@@ -0,0 +1,90 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+    <meta http-equiv="X-UA-Compatible" content="IE=9" />
+    <link rel="stylesheet" type="text/css" href="../../../css/styles.css" />
+    <link rel="stylesheet" type="text/css" href="../../../css/snippet.css" />
+    <script type="text/javascript" src="../../../scripts/snippet.js"></script>
+    <script type="text/javascript" src="../../../scripts/jquery.util.js" charset="utf-8"></script>
+    <script type="text/javascript" src="../../../scripts/common.js" charset="utf-8"></script>
+    <script type="text/javascript" src="../../../scripts/core.js" charset="utf-8"></script>
+    <script type="text/javascript" src="../../../scripts/search.js" charset="utf-8"></script>
+    <title>Device: device's hardware and software versions</title>
+</head>
+
+<body onload="prettyPrint()" style="overflow: auto;">
+
+<div id="toc-navigation">
+    <div id="profile">
+        <p><img alt="Mobile Web" src="../../../images/mobile_s_w.png"/> <img alt="Wearable Web" src="../../../images/wearable_s_w.png"/></p>
+    </div>
+    <div id="toc_border"><div id="toc">
+        <p class="toc-title">Related Info</p>
+        <ul class="toc">
+            <li><a href="../../../../../org.tizen.guides/html/web/tizen/cordova/device_w.htm">Device Guide</a></li>
+            <li><a href="../../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/device.html">Device API for Mobile Web</a></li>
+            <li><a href="../../../../../org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/device.html">Device API for Wearable Web</a></li>
+            <li><a href="../../../../../org.tizen.web.apireference/html/device_api/tv/tizen/cordova/device.html">Device API for TV Web</a></li>
+        </ul>
+    </div></div>
+</div>
+
+<div id="container"><div id="contents"><div class="content">
+
+<h1>Device: device's hardware and software versions</h1>
+
+
+<p>This tutorial demonstrates how you can get information on model, platform and installed version of Cordova.</p>
+
+<table class="note">
+    <tbody>
+    <tr>
+        <th class="note">Note</th>
+    </tr>
+    <tr>
+        <td class="note">To get these information, you need to wait until Cordova is fully set up, wait for <span style="font-family: monospace">deviceready</span> event.
+    </td>
+    </tr>
+    </tbody>
+</table>
+
+<h2 id="loginfo" name="loginfo">Check version, platform and device UUID</h2>
+<p>In following example we will retrieve information on our device, Cordova, and operating sytem, and output it in system log.
+<p>UUID is a unique identifier for a device, and can be the device IMEI (International Mobile Equipment Identity).</p>
+<ol>
+<li><p>Prepare handler for deviceready event:</p><pre class="pretty-print">function onDeviceReady() {
+    //Cordova is ready...
+    console.log( "Cordova version: " + device.cordova );
+    console.log( "Model name: " + device.model );
+    console.log( "Platform: " + device.platform );
+    console.log( "OS version: " + device.version );
+    console.log( "Device UUID: " + device.uuid  );
+}</pre></li>
+<li><p>Wait for deviceready event<pre class="prettyprint">document.addEventListener( "deviceready", onDeviceReady );</pre></li>
+</ol>
+
+<script type="text/javascript" src="../../../scripts/jquery.zclip.min.js"></script>
+<script type="text/javascript" src="../../../scripts/showhide.js"></script>
+
+</div></div></div>
+
+<a class="top sms" href="#"><img src="../../../images/btn_top.gif" alt="Go to top" /></a>
+
+<div id="footer">
+<p class="footer">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br/>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</p>
+</div>
+
+<script type="text/javascript">
+var _gaq = _gaq || [];
+_gaq.push(['_setAccount', 'UA-25976949-1']);
+_gaq.push(['_trackPageview']);
+(function() {
+var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+})();
+</script>
+
+</body>
+</html>