<p class="toc-title">Content</p>
<ul class="toc">
<li><a href="#add">Adding a Shortcut</a></li>
- </ul>
+ </ul>
+ <ul class="toc">
+ <li><a href="#add_widget">Adding a Widget</a></li>
+ </ul>
<p class="toc-title">Related Info</p>
<ul class="toc">
<li><a href="../../../../org.tizen.guides/html/native/app/shortcut_n.htm">Shortcut Guide</a></li>
<li><a href="#add">Adding a Shortcut</a>
<p>Add a shortcut to the home screen.</p></li>
</ul>
+ <ul>
+ <li><a href="#add_widget">Adding a Widget</a>
+ <p>Add a widget to the home screen.</p></li>
+ </ul>
<h2 id="add" name="add">Adding a Shortcut</h2>
<li><p>To add a shortcut, use the <span style="font-family: Courier New,Courier,monospace">shortcut_add_to_home()</span> function:</p>
<pre class="prettyprint">shortcut_add_to_home("Music Player", LAUNCH_BY_APP, NULL, "/path/to/icon", 1, result_cb, NULL);</pre>
-
<p>To add a shortcut, you have to know the package name and set an icon for the application. The icon parameter can be set to <span style="font-family: Courier New,Courier,monospace">NULL</span> (as above) to add a default icon for the application.</p></li>
<li><p>To track possible errors, define a callback function:</p>
}
</pre></li></ol>
+<h2 id="add_widget" name="add_widget">Adding a Widget</h2>
+<p>To add a Widget to the home screen from your application:</p>
+<ol>
+<li>
+<p>Before adding a widget on the home screen, a widget application must be prepared. Refer the <a href="widget_tutorial_n.htm">Widget application tutorial</a> and create a widget application</p>
+</li>
+<li><p>To add a widget, use the <span style="font-family: Courier New,Courier,monospace">shortcut_add_to_home_widget()</span> function:</p>
+
+<pre class="prettyprint">shortcut_add_to_home_widget("alter_name", WIDGET_SIZE_1x1, "org.tizen.testwidget", "/opt/media/Pictures/alter_icon.png", -1.0f, 0, result_cb, NULL);</pre>
+
+<p>To add a widget, you have to know the widget id and supported sizes.</p>
+<p>Alter name and icon will be shown when the widget is not available.</li>
+
+<li><p>To track possible errors, define a callback function:</p>
+<pre class="prettyprint">static int result_cb(int ret, void *data)
+{
+ if (ret < 0)
+ {
+ // Error handling
+ }
+ else
+ {
+ // No error detected
+ }
+}
+</pre></li></ol>
+
<script type="text/javascript" src="../../scripts/jquery.zclip.min.js"></script>
<script type="text/javascript" src="../../scripts/showhide.js"></script>