fixed jira defect TNEF-1392.
authorjiseob.jang <jiseob.jang@samsung.com>
Tue, 21 Apr 2015 13:36:01 +0000 (22:36 +0900)
committerjiseob.jang <jiseob.jang@samsung.com>
Mon, 18 May 2015 07:54:46 +0000 (16:54 +0900)
- modified "create_Account" to "Create_Account"
- modified "account_insert_to_db(account, &id[3])" to "account_insert_to_db(account, &id[3])"
- removed "account_foreach_account_from_db(delete_account, NULL);"
- removed setences that account_connect and account_disconenct contain.

Change-Id: If4cd402432b7cf737c82f2c9717d4a2060cb21f2
Signed-off-by: jiseob.jang <jiseob.jang@samsung.com>
org.tizen.tutorials/html/native/social/account_tutorial_n.htm

index 188f948..76b905f 100644 (file)
                                </ul>
                        </li>
                        <li><a class="opensection" href="#remove">Removing an Account</a></li>
-                       <li><a class="opensection" href="#disconnect">Disconnecting from the Account Service</a></li>
+                       <li><a class="opensection" href="#disconnect">Destroy the Account Handle</a></li>
                        <li><a class="opensection" href="#screen">Adding an Application on the Account Screen</a></li>
                        <li><a class="opensection" href="#queries">Performing Database Queries</a></li>
                        <li><a class="opensection" href="#secret">Managing Account Secrecy</a></li>
                        <li><a class="opensection" href="#update">Updating Accounts</a></li>
-                       <li><a class="opensection" href="#type">Managing Account Types</a></li>
+                       <li><a class="opensection" href="#type">Retrieving Account Types</a></li>
                </ul>
         <p class="toc-title">Related Info</p>
         <ul class="toc">
@@ -51,7 +51,7 @@
  <h1>Account Manager: Managing Account Information on the Device</h1>
   <div class="cont"><div class="static-cont">
   
- <p>This tutorial demonstrates how you can connect to and disconnect from the Account Service, create, delete, and update accounts in the account database, and manage account information, such as user name, display name, domain name, and email address.</p>
+ <p>This tutorial demonstrates how you can create, delete, and update accounts in the account database, and manage account information, such as user name, display name, domain name, and email address.</p>
 
 <h2>Warm-up</h2>
 <p>Become familiar with the Account Manager API basics by learning about:</p>
@@ -72,8 +72,8 @@
                </li>
                <li><a class="opensection" href="#remove">Removing an Account</a>
                <p>Remove an account from the database.</p></li>
-               <li><a class="opensection" href="#disconnect">Disconnecting from the Account Service</a>
-               <p>Destroy the account handle and disconnect from the service.</p></li>
+               <li><a class="opensection" href="#disconnect">Destroy the Account Handle</a>
+               <p>Destroy the account handle.</p></li>
                <li><a class="opensection" href="#screen">Adding an Application on the Account Screen</a>
                <p>Display your application on the Add account screen of a Tizen device.</p>
                </li>
@@ -87,8 +87,8 @@
                <p>Manage account secrecy levels.</p></li>
                <li><a class="opensection" href="#update">Updating Accounts</a>
                <p>Update account details.</p></li>
-               <li><a class="opensection" href="#type">Managing Account Types</a>
-               <p>Manage account types.</p></li>
+               <li><a class="opensection" href="#type">Retrieving Account Types</a>
+               <p>Retrieve account types.</p></li>
                
 </ul>
 
@@ -142,16 +142,10 @@ int ret = 0;
 <span class="fr"><a href="#" class="bt-arr"><em>Hide</em></a></span>
   </div>
                        <div class="devicespec-con">
-<p>To connect to the Account Service, create an account, set it properties, and add it to the account database:</p>
+<p>To create an account, set it properties, and add it to the account database:</p>
 
 <ol>
-<li>To operate on the account database, connect the application with the Account Service using the <span style="font-family: Courier New,Courier,monospace;">account_connect()</span> function:
 
-<pre class="prettyprint">
-ret = account_connect();
-</pre>
-</li>
 <li>Create an account using the <span style="font-family: Courier New,Courier,monospace;">account_create()</span> function and the previously defined account handle:
 
 <pre class="prettyprint">
@@ -285,7 +279,6 @@ static bool on_account_read(account_h account, void *user_data)
                        <div class="devicespec-con"> 
  <p>To retrieve accounts by a specific account provider:</p>
   <ol>
-  <li>Connect with the Account Service using the <span style="font-family: Courier New,Courier,monospace">account_connect()</span> function.</li>
    <li>Define the <span style="font-family: Courier New,Courier,monospace">account_cb()</span> callback for getting data of accounts as a parameter of the <span style="font-family: Courier New,Courier,monospace">account_query_account_by_package_name()</span> function.
    <pre class="prettyprint">
 static bool account_callback(account_h account, void* user_data) // account_cb() callback
@@ -309,7 +302,6 @@ ret = account_query_account_by_package_name(account_callback, package_name, NULL
                        <div class="devicespec-con">
  <p>To retrieve account providers by a specific capability:</p>
   <ol>
-  <li>Connect with the Account Service using the <span style="font-family: Courier New,Courier,monospace">account_connect()</span> function.</li>
    <li>Define <span style="font-family: Courier New,Courier,monospace">account_type_cb()</span> callback for getting account providers as a parameter of the <span style="font-family: Courier New,Courier,monospace">account_type_query_by_provider_feature()</span> function. The callback takes the account provider handle as the first parameter.
 <pre class="prettyprint">
 static bool account_type_callback(account_type_h account_type, void* user_data) // account_type_cb() callback
@@ -321,13 +313,10 @@ static bool account_type_callback(account_type_h account_type, void* user_data)
    
    <li>Retrieve the account providers of a specific capability by using the <span style="font-family: Courier New,Courier,monospace">account_type_query_by_provider_feature()</span> function:
 <pre class="prettyprint">
-account_type_h account_type = NULL;
 int ret = -1;
 char* capability = &quot;http://tizen.org/account/capability/contact&quot;;
 
-ret = account_type_create(&amp;account_type);
-
-ret = account_type_query_by_provider_feature(account_type_callback, capability, account_type);
+ret = account_type_query_by_provider_feature(account_type_callback, capability, NULL);
 </pre></li>
   </ol>
        </div>
@@ -358,11 +347,11 @@ ret = account_delete_from_db_by_id(account_id);
                </li>
                <li>
                        <div class="devicespec-tit">
- <h2 id="disconnect" name="disconnect" class="items-tit-h2">Disconnecting from the Account Service</h2>
+ <h2 id="disconnect" name="disconnect" class="items-tit-h2">Destroy the Account Handle</h2>
 <span class="fr"><a href="#" class="bt-arr"><em>Hide</em></a></span>
   </div>
                        <div class="devicespec-con">
-<p>To disconnect from the Account Service:</p>
+<p>To destroy the Account Handle:</p>
 
 <ol>
 <li>To destroy the account handle, use the <span style="font-family: Courier New,Courier,monospace;">account_destroy()</span> function:
@@ -370,11 +359,6 @@ ret = account_delete_from_db_by_id(account_id);
 ret = account_destroy(account);
 </pre>
 </li>
-<li>To disconnect from the Account Service, use the <span style="font-family: Courier New,Courier,monospace;">account_disconnect()</span> function:
-<pre class="prettyprint">
-ret = account_disconnect();
-</pre>
-</li>
 </ol>
        </div>
                </li>
@@ -450,12 +434,6 @@ ret = account_disconnect();
 
 
 <ol>
-<li>Connect the application with the Account Service using the <span style="font-family: Courier New,Courier,monospace;">account_connect()</span> function:
-
-<pre class="prettyprint">
-ret = account_connect();
-</pre>
-</li>
 <li>Prepare sample content.
 <p>To perform queries, you need existing content in the database. To access existing account, obtain it from the database. It can be done using a few functions, depending on the user requirements.</p>
 <p>To create new content to the database:</p>
@@ -468,7 +446,7 @@ ret = account_connect();
 int id[3];
 static account_h account = NULL;
 
-create_Account(&amp;account, &quot;Person&quot;, &quot;DiplayPerson&quot;, &quot;Person Domain&quot;, &quot;someone1@somewho.com&quot;);
+Create_Account(&amp;account, &quot;Person&quot;, &quot;DiplayPerson&quot;, &quot;Person Domain&quot;, &quot;someone1@somewho.com&quot;);
 
 account_set_capability(account, &quot;Custom&quot;, ACCOUNT_CAPABILITY_ENABLED);
 
@@ -496,7 +474,7 @@ account_insert_to_db(account, &amp;id[2]);
 account_destroy(account);
 
 Create_Account(&amp;account, &quot;LastOne&quot;, &quot;LastDisplay&quot;, &quot;Last Domain&quot;, &quot;someone4@somewho.com&quot;);
-account_insert_to_db(account, &amp;id[2]);
+account_insert_to_db(account, &amp;id[3]);
 account_destroy(account);
 </pre>
 </li>
@@ -685,20 +663,16 @@ static bool _capability_cb(const char *capability_type, account_capability_state
 &nbsp;&nbsp;&nbsp;char buf[200];
 &nbsp;&nbsp;&nbsp;sprintf(buf,&quot;Found capability: %s on state %d\n&quot;, capability_type, capability_state);
 
-&nbsp;&nbsp;&nbsp;return 1;
+&nbsp;&nbsp;&nbsp;return true;
 }
 </pre>
 </li></ul></li>
 
 <li>Clean up.
-<p>When no longer needed, all handles to accounts have to be destroyed and the connection to the database has to be closed. In addition, the sample application deletes all its accounts.</p>
+<p>When no longer needed, all handles to accounts have to be destroyed.</p>
 
 <pre class="prettyprint">
 account_destroy(account);
-
-account_foreach_account_from_db(delete_account, NULL);
-
-account_disconnect();
 </pre>
 </li>
 </ol>
@@ -712,12 +686,6 @@ account_disconnect();
                        <div class="devicespec-con">
 <p>To manage account secrecy:</p>
 <ol>
-<li>Connect the application with the Account Service using the <span style="font-family: Courier New,Courier,monospace;">account_connect()</span> function:
-
-<pre class="prettyprint">
-ret = account_connect();
-</pre>
-</li>
 <li>Select the secrecy level using the <a href="../../../../org.tizen.native.mobile.apireference/group__CAPI__ACCOUNT__MANAGER__MODULE.html#ga41a7e7e7cfb072d0b0ba37087a0535b6">account_secrecy_state_e</a> enumeration.
 
 <pre class="prettyprint">
@@ -771,7 +739,6 @@ account_destroy(account);
 
 List_Accounts(NULL);
 
-account_foreach_account_from_db(delete_account, NULL);
 </pre>
 
 <p>Secrecy is linked only with visibility on the account settings screen. The account is still visible and can be accessed using a query or the <span style="font-family: Courier New,Courier,monospace;">for_each</span> function. For further information on how to add your application to the account screen, see the <a href="account_tutorial_n.htm">Account Tutorial</a>.</p>
@@ -792,14 +759,10 @@ MyCallback Disp.: Visible
 </li>
 
 <li>Clean up.
-<p>Account handles have to be destroyed when not needed anymore. Accounts are removed from the database. The connection has to be terminated.</p>
+<p>Account handles have to be destroyed when not needed anymore.</p>
 
 <pre class="prettyprint">
 account_destroy(account);
-
-account_foreach_account_from_db(delete_account, NULL);
-
-account_disconnect();
 </pre>
 </li>
 </ol>
@@ -814,17 +777,10 @@ account_disconnect();
 <p>To update and track account data.</p>
 
 <ol>
-<li>Connect the application with the Account Service using the <span style="font-family: Courier New,Courier,monospace;">account_connect()</span> function:
-
-<pre class="prettyprint">
-ret = account_connect();
-</pre>
-</li>
 <li>Subscribe notifications.
 <p>To track account changes, create an <span style="font-family: Courier New,Courier,monospace;">account_subscribe_h</span> instance and register a notification.</p>
 
 <pre class="prettyprint">
-account_type_h account_type;
 account_subscribe_h account_subscribe;
 
 account_subscribe_create(&amp;account_subscribe);
@@ -902,7 +858,7 @@ bool _account_event_cb(const char *event_type, int account_id, void *user_data)
 
 &nbsp;&nbsp;&nbsp;sprintf(buf, &quot;ACCOUNT EVENT: %s, %d\n&quot;, event_type, account_id);
 
-&nbsp;&nbsp;&nbsp;return 1;
+&nbsp;&nbsp;&nbsp;return true;
 }
 </pre>
 </li>
@@ -923,10 +879,6 @@ account_destroy(account);
 
 <pre class="prettyprint">
 account_unsubscribe_notification(account_subscribe);
-
-account_destroy(account);
-
-account_foreach_account_from_db(delete_account, NULL);
 </pre>
 </li>
 </ol>
@@ -934,19 +886,13 @@ account_foreach_account_from_db(delete_account, NULL);
                </li>
                <li>
                        <div class="devicespec-tit">
- <h2 id="type" name="type" class="items-tit-h2">Managing Account Types</h2>
+ <h2 id="type" name="type" class="items-tit-h2">Retrieving Account Types</h2>
 <span class="fr"><a href="#" class="bt-arr"><em>Hide</em></a></span>
   </div>
                        <div class="devicespec-con">
-<p>To manage account types:</p>
+<p>To retrieve account types:</p>
 
 <ol>
-<li>Connect the application with the Account Service using the <span style="font-family: Courier New,Courier,monospace;">account_connect()</span> function:
-
-<pre class="prettyprint">
-ret = account_connect();
-</pre>
-</li>
 <li>Create a type.
 <p>To operate on the account type, create a handle to it.</p>
 
@@ -957,8 +903,8 @@ account_type_create(&amp;account_type);
 </pre>
 </li>
 
-<li>Add the type.
-<p>If the account type with a specified ID does not exists, it can be added to the database.</p>
+<li>Get the type information.
+<p>If the account type with a specified ID exists, it can be gotten from the database by account_query_by_app_id() API.</p>
 
 <p>It is possible to set, for example:</p>
 <ul class="ul">
@@ -968,20 +914,26 @@ account_type_create(&amp;account_type);
 <li>Multiple account support (this is only a flag)</li>
 </ul>
 
-<p>After all the options are set, the account type has to be added to the database.</p>
+<p>To get the account types by app id, account_type_query_by_app_id() API is provided.</p>
 
 <pre class="prettyprint">
-if (account_type_query_app_id_exist(type_id))
+int multiple_account_support = -1;
+char *your_app_id = &quot;com.tizen.example&quot;;     // A app id retrieving acccount types
+char *app_id = NULL;
+char *provider_feature = NULL;
+char *icon_path = NULL;
+
+if (account_type_query_app_id_exist(your_app_id))
 {
-&nbsp;&nbsp;&nbsp;account_type_set_app_id(account_type, type_id);
+&nbsp;&nbsp;&nbsp;account_type_query_by_app_id(your_app_id, &amp;account_type);
 
-&nbsp;&nbsp;&nbsp;account_type_set_multiple_account_support(account_type, true);
+&nbsp;&nbsp;&nbsp;account_type_get_app_id(account_type, &amp;app_id);
 
-&nbsp;&nbsp;&nbsp;account_type_set_label(account_type, &quot;TestLable&quot;, &quot;TestLocale&quot;);
+&nbsp;&nbsp;&nbsp;account_type_get_multiple_account_support(account_type, &amp;multiple_account_support);
 
-&nbsp;&nbsp;&nbsp;account_type_set_provider_feature(account_type, &quot;Example Feature&quot;);
+&nbsp;&nbsp;&nbsp;account_type_get_icon_path(account_type, &amp;icon_path);
 
-&nbsp;&nbsp;&nbsp;account_type_insert_to_db(account_type, &amp;id);
+&nbsp;&nbsp;&nbsp;account_type_get_provider_feature(account_type, &amp;provider_feature);
 }
 </pre>
 </li>
@@ -998,13 +950,13 @@ account_type_query_label_by_app_id(_account_label_cb, type_id, NULL);
 <p>While listing the labels, the user has access to the ID of the account type, label and its local value, and the user data passed while casting the query function.</p>
 
 <pre class="prettyprint">
-bool _account_label_cb(char *id, char *label, char *locale, void *user_data)
+bool _account_label_cb(char *app_id, char *label, char *locale, void *user_data)
 {
 &nbsp;&nbsp;&nbsp;char buf[200];
 
 &nbsp;&nbsp;&nbsp;sprintf(buf,&quot;Get Label ID: %s LABEL: %s LOCALE %s\n&quot;, app_id, label, locale);
 
-&nbsp;&nbsp;&nbsp;return 1;
+&nbsp;&nbsp;&nbsp;return true;
 }
 </pre>
 
@@ -1022,20 +974,20 @@ bool _account_type_cb(account_type_h account_type, void *user_data)
 &nbsp;&nbsp;&nbsp;account_type_get_multiple_account_support(account_type, &amp;support);
 &nbsp;&nbsp;&nbsp;sprintf(buf,&quot;Account Type ID: %s Multiple support %d:\n&quot;, id, support);
 
-&nbsp;&nbsp;&nbsp;return 1;
+&nbsp;&nbsp;&nbsp;return true;
 }
 </pre>
 </li>
 
 <li>Clean up.
-<p>All allocated handles have to be destroyed. The account type is also removed. The connection to the database has to be closed.</p>
+<p>All allocated handles have to be destroyed.</p>
 
 <pre class="prettyprint">
-account_type_delete_by_app_id(type_id);
+free(app_id);
+free(provider_feature);
+free(icon_path);
 
 account_type_destroy(account_type);
-
-account_disconnect();
 </pre>
 </li>
 </ol>
@@ -1070,4 +1022,4 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga
 </script>
 
 </body>
-</html>
\ No newline at end of file
+</html>