update widget_n.htm
authorDonghyun Lee <dh0922.lee@samsung.com>
Tue, 15 Dec 2015 10:33:31 +0000 (19:33 +0900)
committerDonghyun Lee <dh0922.lee@samsung.com>
Tue, 15 Dec 2015 10:34:07 +0000 (19:34 +0900)
org.tizen.guides/html/images/mobile_s_n_optional.png [new file with mode: 0644]
org.tizen.guides/html/images/wearable_s_n_optional.png [new file with mode: 0644]
org.tizen.guides/html/images/widget_data_control_share.png [new file with mode: 0644]
org.tizen.guides/html/images/widget_data_share.png [new file with mode: 0644]
org.tizen.guides/html/native/app/widget_n.htm

diff --git a/org.tizen.guides/html/images/mobile_s_n_optional.png b/org.tizen.guides/html/images/mobile_s_n_optional.png
new file mode 100644 (file)
index 0000000..5cf5b18
Binary files /dev/null and b/org.tizen.guides/html/images/mobile_s_n_optional.png differ
diff --git a/org.tizen.guides/html/images/wearable_s_n_optional.png b/org.tizen.guides/html/images/wearable_s_n_optional.png
new file mode 100644 (file)
index 0000000..b7921b6
Binary files /dev/null and b/org.tizen.guides/html/images/wearable_s_n_optional.png differ
diff --git a/org.tizen.guides/html/images/widget_data_control_share.png b/org.tizen.guides/html/images/widget_data_control_share.png
new file mode 100644 (file)
index 0000000..e35f284
Binary files /dev/null and b/org.tizen.guides/html/images/widget_data_control_share.png differ
diff --git a/org.tizen.guides/html/images/widget_data_share.png b/org.tizen.guides/html/images/widget_data_share.png
new file mode 100644 (file)
index 0000000..23d1125
Binary files /dev/null and b/org.tizen.guides/html/images/widget_data_share.png differ
index 58cb66b..02bf99b 100644 (file)
@@ -24,6 +24,7 @@
                        <ul class="toc">\r
                                <li><a href="#app">Widget Application States and Events</a></li>\r
                                <li><a href="#instance">Widget Instance States and Events</a></li>\r
+                               <li><a href="#share">Data Sharing Between the Widget Application and Other Applications</a></li>\r
                        </ul>\r
                <p class="toc-title">Related Info</p>\r
                <ul class="toc">\r
        <p>To ensure that the application runs smoothly, you must <a href="../../../../org.tizen.devtools/html/native_tools/manifest_text_editor_n.htm#widget_app">edit the application manifest file</a> to define the widget settings.</p>\r
        </li>\r
        <li>Creating the widget UI\r
-       <p>The widget application can draw a UI on the home screen. To do this, you must get the window object of the home screen and attach UI components to it. You can use the <span style="font-family: Courier New,Courier,monospace">widget_app_get_elm_win()</span> function to <a href="../../../../org.tizen.tutorials/html/native/app_framework/widget_tutorial_n.htm#get_window">create an EFL object for widget window</a>.</p></li>\r
+       <p>The widget application can draw a UI on the home screen. To do this, you must get the window object of the home screen and attach UI components to it. You can use the <span style="font-family: Courier New,Courier,monospace">widget_app_get_elm_win()</span> function to <a href="../../../../org.tizen.tutorials/html/native/app_framework/widget_tutorial_n.htm#get_window">create an EFL object for widget window</a>.</p>\r
+         <table class="note"> \r
+   <tbody> \r
+    <tr> \r
+     <th class="note">Note</th> \r
+    </tr> \r
+    <tr> \r
+     <td class="note">The widget application UI has a limitation with the scroll action to provide better user experience. Design the widget UI to display all the information within the given area of the screen points.</td> \r
+    </tr> \r
+   </tbody> \r
+  </table> \r
+       \r
+       </li>\r
        </ul>\r
 \r
 <h2 id="app" name="app">Widget Application States and Events</h2>\r
@@ -162,6 +175,37 @@ widget_app_create(void *user_data)
 }\r
 </pre>\r
 \r
+<h2 id="share" name="share">Data Sharing Between the Widget Application and Other Applications</h2>\r
+\r
+<p>You can share data between widget applications and UI (or service) applications. However, you must understand that this kind of data sharing is based on the file system. The reason is that the system (Home screen) controls the widget application life-cycle, while the UI application life-cycle is mostly explicitly controlled by the user.</p>\r
+\r
+<p>For example, consider the differences between a Weather application and a Weather widget:</p>\r
+<ul>\r
+<li>The Weather application is launched when user selects it from the application list.</li>\r
+<li>The widget is launched when the Home screen is on screen and is terminated when the Home screen is hidden.</li></ul>\r
+\r
+<p>Although the widget wants to share some data from the Weather application (such as the user&#39;s favorite city), it is ineffective for the widget to launch the Weather application every time to retrieve such data. This inefficiency makes it difficult to use typical IPC mechanisms, such as socket and <a href="message_port_n.htm">Message Port</a>, in which both the receiver and sender processes must be alive for communication. To overcome this issue, the widget application must use a communication type where the data is permanently stored somewhere in the system.</p> \r
+\r
+<p>In the Tizen platform, applications in the same package (including widget applications) can access files in the <span style="font-family: Courier New,Courier,monospace">data</span> directory of the package installation path. This means that the UI (or service) application can first write files to the <span style="font-family: Courier New,Courier,monospace">data</span> directory, and the widget can later read them, or vice versa.</p>\r
+\r
+<p class="figure">Figure: Sharing through the data directory</p> \r
+<p align="center"><img alt="Sharing through the data directory" src="../../images/widget_data_share.png" /></p> \r
+\r
+<p>To manage data through the <span style="font-family: Courier New,Courier,monospace">data</span> directory:</p>\r
+\r
+<ul>\r
+<li><p>You can set and get data in the <span style="font-family: Courier New,Courier,monospace">data</span> directory using the Preference API functions (in <a href="../../../../org.tizen.native.mobile.apireference/group__CAPI__PREFERENCE__MODULE.html">mobile</a> and <a href="../../../../org.tizen.native.wearable.apireference/group__CAPI__PREFERENCE__MODULE.html">wearable</a> applications). You can use the functions to <a href="../../../../org.tizen.tutorials/html/native/app_framework/preference_tutorial_n.htm">store and retrieve key-value data</a> in the <span style="font-family: Courier New,Courier,monospace">data</span> directory.</p></li>\r
+\r
+<li><p>You can share the <span style="font-family: Courier New,Courier,monospace">data</span> directory content with Sqlite, by creating an Sqlite database file in the <span style="font-family: Courier New,Courier,monospace">data</span> directory.</p>\r
+<p>The Sqlite database has an advantage to a direct use of a file in error handling, such as journaling. Consequently, if the application must handle complex data rather than primitive values, <a href="../../../../org.tizen.tutorials/html/native/base/sqlite_tutorial_n.htm">use Sqlite to store and retrieve the data</a>.</p></li></ul>\r
+\r
+<p>If an application requires complex control over a widget, such as Music Player, it must implement a service application in the middle and use the Data Control API (in <a href="../../../../org.tizen.native.mobile.apireference/group__CAPI__DATA__CONTROL__MODULE.html">mobile</a> and <a href="../../../../org.tizen.native.wearable.apireference/group__CAPI__DATA__CONTROL__MODULE.html">wearable</a> applications).</p>\r
+<p>For example, a music-player-service service application is needed to control the audio device, process audio files, and handle play and stop signals. The music-player-ui and music-player-widget applications display the UI controls, title, album arts, and other content retrieved from the music-player-service service application. The service application can export its data using the Data Control to <a href="data_control_n.htm">provide data to the other applications</a> (widget and UI) simultaneously.</p>\r
+\r
+<p>The following figure illustrates typical data control flows between the set of UI, service, and widget applications.</p>\r
+\r
+<p class="figure">Figure: Sharing through data control</p> \r
+<p align="center"><img alt="Sharing through data control" src="../../images/widget_data_control_share.png" /></p>\r
 \r
 <script type="text/javascript" src="../../scripts/jquery.zclip.min.js"></script>\r
 <script type="text/javascript" src="../../scripts/showhide.js"></script>\r