-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\r
-<head>\r
- <meta http-equiv="content-type" content="text/html; charset=utf-8" />\r
- <meta http-equiv="X-UA-Compatible" content="IE=9" />\r
- <link rel="stylesheet" type="text/css" href="../../../css/styles.css" />\r
- <link rel="stylesheet" type="text/css" href="../../../css/snippet.css" />\r
- <script type="text/javascript" src="../../../scripts/snippet.js"></script>\r
- <script type="text/javascript" src="../../../scripts/jquery.util.js" charset="utf-8"></script>\r
- <script type="text/javascript" src="../../../scripts/common.js" charset="utf-8"></script>\r
- <script type="text/javascript" src="../../../scripts/core.js" charset="utf-8"></script>\r
- <script type="text/javascript" src="../../../scripts/search.js" charset="utf-8"></script>\r
- <title>Account: Managing Accounts and Account Information</title>\r
- </head>\r
-<body onload="prettyPrint()" style="overflow: auto;">\r
-\r
-<div id="toc-navigation">\r
- <div id="profile">\r
- <p><img alt="Mobile Web" src="../../../images/mw_icon.png"/></p>\r
- </div>\r
- <div id="toc_border"><div id="toc">\r
- <p class="toc-title">Content</p>\r
- <ul class="toc">\r
- <li><a href="#get_account">Retrieving Accounts</a></li>\r
- <li><a href="#get_providers">Retrieving Providers</a></li>\r
- <li><a href="#manage">Managing Accounts</a></li>\r
- <li><a href="#listener">Receiving Notifications on Account Changes</a></li>\r
- <li><a href="#extend">Managing Extended Account Data</a></li>\r
- </ul>\r
- <p class="toc-title">Related Info</p>\r
- <ul class="toc">\r
- <li><a href="../../../../../org.tizen.guides/html/web/tizen/social/account_w.htm">Account Guide</a></li>\r
- <li><a href="../../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/account.html">Account API for Mobile Web</a></li>\r
- </ul>\r
- </div></div>\r
-</div>\r
-\r
-<div id="container"><div id="contents"><div class="content">\r
-\r
- <h1>Account: Managing Accounts and Account Information</h1>\r
- \r
-<p>This tutorial demonstrates how you can manage accounts and retrieve account information.</p>\r
-\r
- <table class="note"> \r
-<tbody> \r
- <tr> \r
- <th class="note">Note</th> \r
- </tr> \r
- <tr> \r
- <td class="note">This feature is supported in mobile applications only.</td> \r
- </tr> \r
- </tbody> \r
- </table>\r
- \r
-<h2>Warm-up</h2>\r
-<p>Become familiar with the Account API basics by learning about:</p>\r
-<ul>\r
-<li><a href="#get_account">Retrieving Accounts</a>\r
-<p>Get all accounts or one with a specific ID.</p>\r
-</li>\r
-<li><a href="#get_providers">Retrieving Providers</a>\r
-<p>Get the account provider belonging to current application or get all account providers.</p>\r
-</li>\r
-<li><a href="#manage">Managing Accounts</a>\r
-<p>Add, update, and remove an account.</p>\r
-</li>\r
-<li><a href="#listener">Receiving Notifications on Account Changes</a>\r
-<p>Register and remove an account change listener.</p>\r
-</li>\r
-<li><a href="#extend">Managing Extended Account Data</a>\r
-<p>Get and set extended data for an account.</p>\r
-</li>\r
-</ul>\r
-\r
- <h2 id="get_account" name="get_account">Retrieving Accounts</h2>\r
- \r
-\r
-<p>Learning how to retrieve account information enables you to include account support into your applications:</p>\r
-\r
-<ul>\r
-<li>To retrieve information about all available accounts, use the <span style="font-family: Courier New,Courier,monospace">getAccounts()</span> method of the <a href="../../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/account.html#AccountManager">AccountManager</a> interface:\r
-\r
-<pre class="prettyprint">function getAccountsSuccess(accounts)\r
-{\r
- for (var i = 0; i < accounts.length; i++)\r
- {\r
- /* Use the retrieved accounts */\r
- }\r
-}\r
-function getAccountsError(error)\r
-{\r
- console.log('Error: ' + error.message);\r
-}\r
-tizen.account.getAccounts(getAccountsSuccess, getAccountsError);</pre>\r
-</li>\r
-\r
-<li>If you already know the ID of the account, you can get the <a href="../../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/account.html#Account">Account</a> object using the <span style="font-family: Courier New,Courier,monospace">getAccount()</span> method of the <span style="font-family: Courier New,Courier,monospace">AccountManager</span> interface:\r
-\r
-<pre class="prettyprint">var account = tizen.account.getAccount(my_account_id);</pre>\r
-</li>\r
-</ul>\r
- \r
- <h2 id="get_providers" name="get_providers">Retrieving Providers</h2>\r
-\r
-<p>To create accounts, you must learn how to get access to account providers:</p>\r
-\r
-<table class="note">\r
- <tbody>\r
- <tr>\r
- <th class="note">Note</th>\r
- </tr>\r
- <tr>\r
- <td class="note">To perform these operations, your application needs the <span style="font-family: Courier New,Courier,monospace">http://tizen.org/privilege/account.read</span> privilege.</td>\r
- </tr>\r
- </tbody>\r
-</table>\r
-\r
-<ul>\r
-<li>Get a specific account provider with the given application ID using the <span style="font-family: Courier New,Courier,monospace">getProviders()</span> method of the <a href="../../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/application.html#ApplicationManager">ApplicationManager</a> interface.\r
-<p>If the current application is an account provider application (meaning that it contains the <a href="../../../../../org.tizen.devtools/html/web_tools/config_editor_w.htm#mw_account"><tizen:account></a> element in its <span style="font-family: Courier New,Courier,monospace">config.xml</span> file), you can use the current application ID. Otherwise, get the ID of the current application using the <span style="font-family: Courier New,Courier,monospace">getCurrentApplication()</span> method of the <span style="font-family: Courier New,Courier,monospace">ApplicationManager</span> interface:</p>\r
-\r
-<pre class="prettyprint">var appId = tizen.application.getCurrentApplication().appInfo.id;\r
-var provider = tizen.account.getProvider(appId);</pre>\r
-</li>\r
-<li>To get information about all available account providers, use the <span style="font-family: Courier New,Courier,monospace">getProviders()</span> method of the <span style="font-family: Courier New,Courier,monospace">AccountManager</span> interface:\r
-\r
-<pre class="prettyprint">function getProvidersSuccess(providers)\r
-{\r
- /* Providers is an array whose members are providers with contact capability */\r
-}\r
-function getProvidersError(error)\r
-{\r
- console.log('Error: ' + error.message);\r
-}\r
-\r
-tizen.account.getProviders(getProvidersSuccess, getProvidersError, "http://tizen.org/account/capability/contact");</pre>\r
-</li>\r
-</ul>\r
- \r
- <h2 id="manage" name="manage">Managing Accounts</h2>\r
-\r
-<p>Creating, adding, updating, and deleting accounts is a basic account management skill:</p>\r
-\r
-<table class="note">\r
- <tbody>\r
- <tr>\r
- <th class="note">Note</th>\r
- </tr>\r
- <tr>\r
- <td class="note">To perform these operations, your application needs the <span style="font-family: Courier New,Courier,monospace">http://tizen.org/privilege/account.write</span> privilege and must be the account provider.</td>\r
- </tr>\r
- </tbody>\r
-</table>\r
-\r
-<ol>\r
-<li>To create an account, first get an account provider. If your application is an account provider application (meaning that it contains the <a href="../../../../../org.tizen.devtools/html/web_tools/config_editor_w.htm#mw_account"><tizen:account></a> element in its <span style="font-family: Courier New,Courier,monospace">config.xml</span> file), use the <span style="font-family: Courier New,Courier,monospace">getProvider()</span> method:\r
-\r
-<pre class="prettyprint">var appId = tizen.application.getCurrentApplication().appInfo.id;\r
-var accountProvider = tizen.account.getProvider(appId);</pre>\r
-</li>\r
-<li>Create an instance of the <a href="../../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/account.html#Account">Account</a> interface:\r
-\r
-<pre class="prettyprint">var account = new tizen.Account(accountProvider, {userName: 'admin', iconUri: 'path/to/icon.jpg'});</pre>\r
-</li>\r
-<li>Add the account to the account database:\r
-\r
-<pre class="prettyprint">tizen.account.add(account);</pre>\r
-</li>\r
-<li>To update the account information, change the attributes of the <span style="font-family: Courier New,Courier,monospace">Account</span> object for the relevant account:\r
-\r
-<pre class="prettyprint">account.userName = 'new username';</pre>\r
-</li>\r
-<li>To save the changed values, use the <span style="font-family: Courier New,Courier,monospace">update()</span> method of the <a href="../../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/account.html#AccountManager">AccountManager</a> interface:\r
-\r
-<pre class="prettyprint">tizen.account.update(account);</pre>\r
-</li>\r
-\r
-<li>To remove the account from the system, use the <span style="font-family: Courier New,Courier,monospace">remove()</span> method of the <span style="font-family: Courier New,Courier,monospace">AccountManager</span> interface, providing the account ID:\r
-\r
-<pre class="prettyprint">tizen.account.remove(account.id);</pre>\r
-</li>\r
-</ol>\r
- \r
- <h2 id="listener" name="listener">Receiving Notifications on Account Changes</h2>\r
-\r
-<p>Learning how to register change listeners enables you to synchronize the view of your application with the changes in the account database:</p>\r
-\r
-<table class="note">\r
- <tbody>\r
- <tr>\r
- <th class="note">Note</th>\r
- </tr>\r
- <tr>\r
- <td class="note">To perform these operations, your application needs the <span style="font-family: Courier New,Courier,monospace">http://tizen.org/privilege/account.read</span> privilege.</td>\r
- </tr>\r
- </tbody>\r
-</table>\r
-\r
-<ol>\r
-<li>Define a listener implementing the <a href="../../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/account.html#AccountChangeCallback">AccountChangeCallback</a> interface:\r
-\r
-<pre class="prettyprint">var accountChangeListener =\r
-{\r
- onadded: function(account)\r
- {\r
- /* Called when an account is added */\r
- },\r
- onremoved: function(accountId)\r
- {\r
- /* Called when an account is removed */\r
- },\r
- onupdated: function(account)\r
- {\r
- /* Called when a registered account is changed */\r
- }\r
-};</pre>\r
-</li>\r
-<li>Register the account listener using the <span style="font-family: Courier New,Courier,monospace">addAccountListener()</span> method of the <a href="../../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/account.html#AccountManager">AccountManager</a> interface to start receiving notifications about changes:\r
-\r
-<pre class="prettyprint">var watchId = tizen.account.addAccountListener(accountChangeListener);</pre>\r
-</li>\r
-<li>When notifications are no longer required, unregister the listener using the <span style="font-family: Courier New,Courier,monospace">removeAccountListener()</span> method of the <span style="font-family: Courier New,Courier,monospace">AccountManager</span> interface:\r
-\r
-<pre class="prettyprint">tizen.account.removeAccountListener(watchId);</pre>\r
-</li>\r
-</ol>\r
- <h2 id="extend" name="extend">Managing Extended Account Data</h2>\r
-\r
-<p>Learning how to manage extended data for an account enables you to include account support into your applications:</p>\r
-\r
-<ol>\r
-<li><a href="#get_account">Retrieve the account object</a>.</li>\r
-<li>Manage the extended data for the retrieved account:\r
-<ul><li>To set extended data:\r
-<p>Set the additional information with the <span style="font-family: Courier New,Courier,monospace">setExtendedData()</span> method:</p>\r
-\r
-<pre class="prettyprint">var key = 'nickname';\r
-var value = 'nickname of anonymous user';\r
-account.setExtendedData(key, value);</pre>\r
-\r
-<table class="note">\r
- <tbody>\r
- <tr>\r
- <th class="note">Note</th>\r
- </tr>\r
- <tr>\r
- <td class="note">To perform this operation, your application needs the <span style="font-family: Courier New,Courier,monospace">http://tizen.org/privilege/account.write</span> privilege.</td>\r
- </tr>\r
- </tbody>\r
-</table>\r
-<p>To overwrite the previous data value, set a new value with the same key:</p>\r
-\r
-<pre class="prettyprint">account.setExtendedData(key, 'nickname updated');</pre>\r
-</li>\r
-\r
-<li>To get extended data:\r
-<ul><li>To retrieve extended data value for a specific key, use the <span style="font-family: Courier New,Courier,monospace">getExtendedData()</span> method:\r
-\r
-<pre class="prettyprint">var key = 'accessToken';\r
-var value = account.getExtendedData(key); </pre>\r
-\r
-<table class="note">\r
- <tbody>\r
- <tr>\r
- <th class="note">Note</th>\r
- </tr>\r
- <tr>\r
- <td class="note">To perform this operation, your application needs the <span style="font-family: Courier New,Courier,monospace">http://tizen.org/privilege/account.read</span> privilege.</td>\r
- </tr>\r
- </tbody>\r
-</table>\r
-</li>\r
-<li>To retrieve all extended data for an account, use the asynchronous version of the <span style="font-family: Courier New,Courier,monospace">getExtendedData()</span> method. The success callback contains an array of the extended data key-value pairs.\r
-\r
-<pre class="prettyprint">account.getExtendedData(function(extendedData)\r
- {\r
- for (var i = 0; i < extendedData.length; i++)\r
- {\r
- var key = extendedData.key;\r
- var value = extendedData.value;\r
- console.log(key + " : " + value);\r
- }\r
- },\r
- function(e)\r
- {\r
- console.log("Error : " + e.message);\r
- });</pre>\r
-\r
-</li></ul></li></ul></li>\r
-\r
-</ol>\r
- \r
-\r
-<script type="text/javascript" src="../../../scripts/jquery.zclip.min.js"></script>\r
-<script type="text/javascript" src="../../../scripts/showhide.js"></script>\r
-\r
-</div></div></div>\r
-\r
-<a class="top sms" href="#"><img src="../../../images/btn_top.gif" alt="Go to top" /></a>\r
-\r
-<div id="footer">\r
-<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>\r
-</div>\r
-\r
-<script type="text/javascript">\r
-var _gaq = _gaq || [];\r
-_gaq.push(['_setAccount', 'UA-25976949-1']);\r
-_gaq.push(['_trackPageview']);\r
-(function() {\r
-var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\r
-ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\r
-var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\r
-})();\r
-</script>\r
-\r
-</body>\r
+<!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>Account: Managing Accounts and Account Information</title>
+ </head>
+<body onload="prettyPrint()" style="overflow: auto;">
+
+<div id="toc-navigation">
+ <div id="profile">
+ <p><img alt="Mobile Web" src="../../../images/mw_icon.png"/></p>
+ </div>
+ <div id="toc_border"><div id="toc">
+ <p class="toc-title">Content</p>
+ <ul class="toc">
+ <li><a href="#get_account">Retrieving Accounts</a></li>
+ <li><a href="#get_providers">Retrieving Providers</a></li>
+ <li><a href="#manage">Managing Accounts</a></li>
+ <li><a href="#listener">Receiving Notifications on Account Changes</a></li>
+ <li><a href="#extend">Managing Extended Account Data</a></li>
+ </ul>
+ <p class="toc-title">Related Info</p>
+ <ul class="toc">
+ <li><a href="../../../../../org.tizen.guides/html/web/tizen/social/account_w.htm">Account Guide</a></li>
+ <li><a href="../../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/account.html">Account API for Mobile Web</a></li>
+ </ul>
+ </div></div>
+</div>
+
+<div id="container"><div id="contents"><div class="content">
+
+ <h1>Account: Managing Accounts and Account Information</h1>
+
+<p>This tutorial demonstrates how you can manage accounts and retrieve account information.</p>
+
+ <table class="note">
+<tbody>
+ <tr>
+ <th class="note">Note</th>
+ </tr>
+ <tr>
+ <td class="note">This feature is supported in mobile applications only.</td>
+ </tr>
+ </tbody>
+ </table>
+
+<h2>Warm-up</h2>
+<p>Become familiar with the Account API basics by learning about:</p>
+<ul>
+<li><a href="#get_account">Retrieving Accounts</a>
+<p>Get all accounts or one with a specific ID.</p>
+</li>
+<li><a href="#get_providers">Retrieving Providers</a>
+<p>Get the account provider belonging to current application or get all account providers.</p>
+</li>
+<li><a href="#manage">Managing Accounts</a>
+<p>Add, update, and remove an account.</p>
+</li>
+<li><a href="#listener">Receiving Notifications on Account Changes</a>
+<p>Register and remove an account change listener.</p>
+</li>
+<li><a href="#extend">Managing Extended Account Data</a>
+<p>Get and set extended data for an account.</p>
+</li>
+</ul>
+
+ <h2 id="get_account" name="get_account">Retrieving Accounts</h2>
+
+
+<p>Learning how to retrieve account information enables you to include account support into your applications:</p>
+
+<ul>
+<li>To retrieve information about all available accounts, use the <span style="font-family: Courier New,Courier,monospace">getAccounts()</span> method of the <a href="../../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/account.html#AccountManager">AccountManager</a> interface:
+
+<pre class="prettyprint">function getAccountsSuccess(accounts)
+{
+ for (var i = 0; i < accounts.length; i++)
+ {
+ /* Use the retrieved accounts */
+ }
+}
+function getAccountsError(error)
+{
+ console.log('Error: ' + error.message);
+}
+tizen.account.getAccounts(getAccountsSuccess, getAccountsError);</pre>
+</li>
+
+<li>If you already know the ID of the account, you can get the <a href="../../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/account.html#Account">Account</a> object using the <span style="font-family: Courier New,Courier,monospace">getAccount()</span> method of the <span style="font-family: Courier New,Courier,monospace">AccountManager</span> interface:
+
+<pre class="prettyprint">var account = tizen.account.getAccount(my_account_id);</pre>
+</li>
+</ul>
+
+ <h2 id="get_providers" name="get_providers">Retrieving Providers</h2>
+
+<p>To create accounts, you must learn how to get access to account providers:</p>
+
+<table class="note">
+ <tbody>
+ <tr>
+ <th class="note">Note</th>
+ </tr>
+ <tr>
+ <td class="note">To perform these operations, your application needs the <span style="font-family: Courier New,Courier,monospace">http://tizen.org/privilege/account.read</span> privilege.</td>
+ </tr>
+ </tbody>
+</table>
+
+<ul>
+<li>Get a specific account provider with the given application ID using the <span style="font-family: Courier New,Courier,monospace">getProviders()</span> method of the <a href="../../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/application.html#ApplicationManager">ApplicationManager</a> interface.
+<p>If the current application is an account provider application (meaning that it contains the <a href="../../../../../org.tizen.devtools/html/web_tools/config_editor_w.htm#mw_account"><tizen:account></a> element in its <span style="font-family: Courier New,Courier,monospace">config.xml</span> file), you can use the current application ID. Otherwise, get the ID of the current application using the <span style="font-family: Courier New,Courier,monospace">getCurrentApplication()</span> method of the <span style="font-family: Courier New,Courier,monospace">ApplicationManager</span> interface:</p>
+
+<pre class="prettyprint">var appId = tizen.application.getCurrentApplication().appInfo.id;
+var provider = tizen.account.getProvider(appId);</pre>
+</li>
+<li>To get information about all available account providers, use the <span style="font-family: Courier New,Courier,monospace">getProviders()</span> method of the <span style="font-family: Courier New,Courier,monospace">AccountManager</span> interface:
+
+<pre class="prettyprint">function getProvidersSuccess(providers)
+{
+ /* Providers is an array whose members are providers with contact capability */
+}
+function getProvidersError(error)
+{
+ console.log('Error: ' + error.message);
+}
+
+tizen.account.getProviders(getProvidersSuccess, getProvidersError, "http://tizen.org/account/capability/contact");</pre>
+</li>
+</ul>
+
+ <h2 id="manage" name="manage">Managing Accounts</h2>
+
+<p>Creating, adding, updating, and deleting accounts is a basic account management skill:</p>
+
+<table class="note">
+ <tbody>
+ <tr>
+ <th class="note">Note</th>
+ </tr>
+ <tr>
+ <td class="note">To perform these operations, your application needs the <span style="font-family: Courier New,Courier,monospace">http://tizen.org/privilege/account.write</span> privilege and must be the account provider.</td>
+ </tr>
+ </tbody>
+</table>
+
+<ol>
+<li>To create an account, first get an account provider. If your application is an account provider application (meaning that it contains the <a href="../../../../../org.tizen.devtools/html/web_tools/config_editor_w.htm#mw_account"><tizen:account></a> element in its <span style="font-family: Courier New,Courier,monospace">config.xml</span> file), use the <span style="font-family: Courier New,Courier,monospace">getProvider()</span> method:
+
+<pre class="prettyprint">var appId = tizen.application.getCurrentApplication().appInfo.id;
+var accountProvider = tizen.account.getProvider(appId);</pre>
+</li>
+<li>Create an instance of the <a href="../../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/account.html#Account">Account</a> interface:
+
+<pre class="prettyprint">var account = new tizen.Account(accountProvider, {userName: 'admin', iconUri: 'path/to/icon.jpg'});</pre>
+</li>
+<li>Add the account to the account database:
+
+<pre class="prettyprint">tizen.account.add(account);</pre>
+</li>
+<li>To update the account information, change the attributes of the <span style="font-family: Courier New,Courier,monospace">Account</span> object for the relevant account:
+
+<pre class="prettyprint">account.userName = 'new username';</pre>
+</li>
+<li>To save the changed values, use the <span style="font-family: Courier New,Courier,monospace">update()</span> method of the <a href="../../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/account.html#AccountManager">AccountManager</a> interface:
+
+<pre class="prettyprint">tizen.account.update(account);</pre>
+</li>
+
+<li>To remove the account from the system, use the <span style="font-family: Courier New,Courier,monospace">remove()</span> method of the <span style="font-family: Courier New,Courier,monospace">AccountManager</span> interface, providing the account ID:
+
+<pre class="prettyprint">tizen.account.remove(account.id);</pre>
+</li>
+</ol>
+
+ <h2 id="listener" name="listener">Receiving Notifications on Account Changes</h2>
+
+<p>Learning how to register change listeners enables you to synchronize the view of your application with the changes in the account database:</p>
+
+<table class="note">
+ <tbody>
+ <tr>
+ <th class="note">Note</th>
+ </tr>
+ <tr>
+ <td class="note">To perform these operations, your application needs the <span style="font-family: Courier New,Courier,monospace">http://tizen.org/privilege/account.read</span> privilege.</td>
+ </tr>
+ </tbody>
+</table>
+
+<ol>
+<li>Define a listener implementing the <a href="../../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/account.html#AccountChangeCallback">AccountChangeCallback</a> interface:
+
+<pre class="prettyprint">var accountChangeListener =
+{
+ onadded: function(account)
+ {
+ /* Called when an account is added */
+ },
+ onremoved: function(accountId)
+ {
+ /* Called when an account is removed */
+ },
+ onupdated: function(account)
+ {
+ /* Called when a registered account is changed */
+ }
+};</pre>
+</li>
+<li>Register the account listener using the <span style="font-family: Courier New,Courier,monospace">addAccountListener()</span> method of the <a href="../../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/account.html#AccountManager">AccountManager</a> interface to start receiving notifications about changes:
+
+<pre class="prettyprint">var watchId = tizen.account.addAccountListener(accountChangeListener);</pre>
+</li>
+<li>When notifications are no longer required, unregister the listener using the <span style="font-family: Courier New,Courier,monospace">removeAccountListener()</span> method of the <span style="font-family: Courier New,Courier,monospace">AccountManager</span> interface:
+
+<pre class="prettyprint">tizen.account.removeAccountListener(watchId);</pre>
+</li>
+</ol>
+ <h2 id="extend" name="extend">Managing Extended Account Data</h2>
+
+<p>Learning how to manage extended data for an account enables you to include account support into your applications:</p>
+
+<ol>
+<li><a href="#get_account">Retrieve the account object</a>.</li>
+<li>Manage the extended data for the retrieved account:
+<ul><li>To set extended data:
+<p>Set the additional information with the <span style="font-family: Courier New,Courier,monospace">setExtendedData()</span> method:</p>
+
+<pre class="prettyprint">var key = 'nickname';
+var value = 'nickname of anonymous user';
+account.setExtendedData(key, value);</pre>
+
+<table class="note">
+ <tbody>
+ <tr>
+ <th class="note">Note</th>
+ </tr>
+ <tr>
+ <td class="note">To perform this operation, your application needs the <span style="font-family: Courier New,Courier,monospace">http://tizen.org/privilege/account.write</span> privilege.</td>
+ </tr>
+ </tbody>
+</table>
+<p>To overwrite the previous data value, set a new value with the same key:</p>
+
+<pre class="prettyprint">account.setExtendedData(key, 'nickname updated');</pre>
+</li>
+
+<li>To get extended data:
+<ul><li>To retrieve extended data value for a specific key, use the <span style="font-family: Courier New,Courier,monospace">getExtendedData()</span> method:
+
+<pre class="prettyprint">var key = 'accessToken';
+var value = account.getExtendedData(key); </pre>
+
+<table class="note">
+ <tbody>
+ <tr>
+ <th class="note">Note</th>
+ </tr>
+ <tr>
+ <td class="note">To perform this operation, your application needs the <span style="font-family: Courier New,Courier,monospace">http://tizen.org/privilege/account.read</span> privilege.</td>
+ </tr>
+ </tbody>
+</table>
+</li>
+<li>To retrieve all extended data for an account, use the asynchronous version of the <span style="font-family: Courier New,Courier,monospace">getExtendedData()</span> method. The success callback contains an array of the extended data key-value pairs.
+
+<pre class="prettyprint">account.getExtendedData(function(extendedData)
+ {
+ for (var i = 0; i < extendedData.length; i++)
+ {
+ var key = extendedData.key;
+ var value = extendedData.value;
+ console.log(key + " : " + value);
+ }
+ },
+ function(e)
+ {
+ console.log("Error : " + e.message);
+ });</pre>
+
+</li></ul></li></ul></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>
\ No newline at end of file