[Guide] Adding guide for networkbearerselection module 68/153468/10
authorMichal Bistyga <m.bistyga@samsung.com>
Thu, 28 Sep 2017 11:53:00 +0000 (13:53 +0200)
committerEditor Lionbridge <TizenEditor.SEL@lionbridge.com>
Tue, 10 Oct 2017 10:02:45 +0000 (13:02 +0300)
PS5: Reviewed
PS10: Reviewed again after changes

Change-Id: Ia0e5a287d489875a85ff6edd012e312467bced9d
Signed-off-by: Michal Bistyga <m.bistyga@samsung.com>
Signed-off-by: Pawel Wasowski <p.wasowski2@partner.samsung.com>
org.tizen.guides/html/index.htm
org.tizen.guides/html/web/connectivity/connectivity_cover_w.htm
org.tizen.guides/html/web/connectivity/nbs_w.htm [new file with mode: 0644]
org.tizen.guides/index.xml

index a97bbb0..bd5b21b 100644 (file)
                                <li><a href="web/connectivity/nfc_w.htm" target="content">NFC</a></li>
                                <li><a href="web/connectivity/secure_element_w.htm" target="content">Secure Element Access</a></li>
                                <li><a href="web/connectivity/download_w.htm" target="content">Content Downloads</a></li>
+                               <li><a href="web/connectivity/nbs_w.htm" target="content">Network Bearer Selection</a></li>
                        </ul>
                </li>
                <li><a href="web/messaging/messaging_cover_w.htm" target="content">Messaging</a>
index 8d9d0af..32649c3 100644 (file)
 <li><a href="download_w.htm">Content Downloads</a>
 
 <p>You can download files from the Internet. You can also monitor the download progress to keep the user informed of the status.</p></li>
+
+<li><a href="nbs_w.htm">Network Bearer Selection</a> <strong>in mobile applications only</strong>
+
+<p>You can request a preferred connection network type for a domain.</p></li>
 </ul>
 
 <script type="text/javascript" src="../../scripts/jquery.zclip.min.js"></script>
diff --git a/org.tizen.guides/html/web/connectivity/nbs_w.htm b/org.tizen.guides/html/web/connectivity/nbs_w.htm
new file mode 100644 (file)
index 0000000..5fd4c2f
--- /dev/null
@@ -0,0 +1,139 @@
+<!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>Network Bearer Selection</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_optional.png"/></p>
+    </div>
+
+    <div id="toc_border"><div id="toc">
+        <p class="toc-title">Dependencies</p>
+        <ul class="toc">
+            <li>Tizen 2.4 and Higher for Mobile</li>
+        </ul>
+        <p class="toc-title">Content</p>
+        <ul class="toc">
+                <li><a href="#prerequisites">Prerequisites</a></li>
+                <li><a href="#request">Requesting a Route</a></li>
+                <li><a href="#release">Releasing a Route</a></li>
+        </ul>
+        <p class="toc-title">Related Info</p>
+        <ul class="toc">
+            <li><a href="../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/networkbearerselection.html">Network Bearer Selection API for Mobile Web</a></li>
+        </ul>
+    </div></div>
+</div>
+
+
+<div id="container"><div id="contents"><div class="content">
+  <h1>Network Bearer Selection</h1>
+
+  <p>You can set a cellular network as a preferred route for Internet connections with specified domains.</p>
+
+   <p>This feature is supported in mobile applications only.</p>
+
+   <p>The main features of the Network Bearer Selection API include:</p>
+   <ul>
+    <li>Requesting a route
+        <p>You can <a href="#request">request a preferred network</a> for the Internet connection with a specified domain.</p>
+               <p>The request implements a routing policy for Internet connections from the application that demanded them, as well as from other programs.</p></li>
+    <li>Releasing a route
+        <p>You can <a href="#release">cancel the preference</a> for a particular network for the Internet connection with a specified domain.</p>
+               <p>The routing policy can be terminated any time. All rules requested by the application are terminated at the end of the application life-cycle.</p></li>
+   </ul>
+
+<h2 id="prerequisites">Prerequisites</h2>
+
+<p>To use the <a href="../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/networkbearerselection.html">Network Bearer Selection</a> API, the application has to request permission by adding the following privileges to the <code>config.xml</code> file:</p>
+<pre class="prettyprint">
+&lt;tizen:privilege name="http://tizen.org/privilege/internet"/&gt;
+&lt;tizen:privilege name="http://tizen.org/privilege/networkbearerselection"/&gt;
+</pre>
+
+<h2 id="request">Requesting a Route</h2>
+
+<p>To request a preferred route for Internet connection with the "www.tizen.org" host:</p>
+
+<ol>
+<li>Define the needed callbacks:
+<pre class="prettyprint">
+var statuscb = {
+    onsuccess: function() {
+        console.log('Routing policy requested');
+    },
+    ondisconnected: function() {
+        console.log('Disconnected');
+    }
+};
+
+function onerror(error) {
+    console.log(error.code + ' error occurred: ' + error.message);
+}
+</pre>
+</li>
+<li>To request a routing policy, use the <code>requestRouteToHost()</code> method of the <a href="../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/networkbearerselection.html#NetworkBearerSelection">NetworkBearerSelection</a> interface:
+<pre class="prettyprint">
+tizen.networkbearerselection.requestRouteToHost('CELLULAR', 'www.tizen.org', statuscb, onerror);
+</pre>
+</li>
+</ol>
+
+<h2 id="release">Releasing a Route</h2>
+
+<p>To cancel the routing policy for the connection with the "www.tizen.org" host:</p>
+
+<ol>
+<li>Define the needed callbacks:
+<pre class="prettyprint">
+function onsuccess() {
+    console.log('Routing policy cancelled');
+}
+
+function onerror(error) {
+    console.log(error.code + ' error occurred: ' + error.message);
+}
+</pre>
+</li>
+<li>To terminate the policy, use the <code>releaseRouteToHost()</code> method of the <a href="../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/networkbearerselection.html#NetworkBearerSelection">NetworkBearerSelection</a> interface:
+<pre class="prettyprint">
+tizen.networkbearerselection.releaseRouteToHost('CELLULAR', 'www.tizen.org', onsuccess, onerror);
+</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>
index f8d600c..18a3a44 100644 (file)
                <topic href="html/web/connectivity/nfc_w.htm" label="NFC"></topic>
                <topic href="html/web/connectivity/secure_element_w.htm" label="Secure Element Access"></topic>
                <topic href="html/web/connectivity/download_w.htm" label="Content Downloads"></topic>
+               <topic href="html/web/connectivity/nbs_w.htm" label="Network Bearer Selection"></topic>
        </topic>
        <topic href="html/web/messaging/messaging_cover_w.htm" label="Messaging">
                <topic href="html/web/messaging/messages_w.htm" label="Messages"></topic>