add files for lbs-geofence application
authorjomui <jongmun.woo@samsung.com>
Mon, 3 Aug 2015 05:46:57 +0000 (14:46 +0900)
committerjomui <jongmun.woo@samsung.com>
Mon, 3 Aug 2015 07:48:21 +0000 (16:48 +0900)
Signed-off-by: jomui <jongmun.woo@samsung.com>
Change-Id: I3a1625820d33ec0da3b416ad301e4d2794396b67

org.tizen.sampledescriptions/html/images/lbs_geofence.png [new file with mode: 0644]
org.tizen.sampledescriptions/html/mobile_n/lbs_geofence_sd_mn.htm [new file with mode: 0644]

diff --git a/org.tizen.sampledescriptions/html/images/lbs_geofence.png b/org.tizen.sampledescriptions/html/images/lbs_geofence.png
new file mode 100644 (file)
index 0000000..b3e50cb
Binary files /dev/null and b/org.tizen.sampledescriptions/html/images/lbs_geofence.png differ
diff --git a/org.tizen.sampledescriptions/html/mobile_n/lbs_geofence_sd_mn.htm b/org.tizen.sampledescriptions/html/mobile_n/lbs_geofence_sd_mn.htm
new file mode 100644 (file)
index 0000000..e566208
--- /dev/null
@@ -0,0 +1,576 @@
+<!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>LBS Geofence Overview</title>
+</head>
+
+<body class="no-toc" onload="prettyPrint()" style="overflow: auto;">
+
+<div id="toc-navigation">
+</div>
+
+<div id="container"><div id="contents"><div class="content">
+       <div id="profile">
+               <p><img alt="Mobile native" src="../images/mn_icon.png"/></p>
+       </div>
+  <h1>LBS Geofence Overview</h1>
+<p>The LBS Geofence application demonstrates how to manage fences and places using the <a href="../../../org.tizen.native.mobile.apireference/group__CAPI__GEOFENCE__MODULE.html">Geofence API</a>.</p>
+<p>The following figure illustrates the main views of the LBS Geofence application.</p>
+       <p class="figure">Figure: Application main view</p>
+       <p align="center"><img alt="Application control view" src="../images/lbs_geofence.png" />
+</p>
+
+<p>In the main view, the user can choose one of the available operations.</p>
+
+<h2>Prerequisites</h2>
+<p>To ensure proper application execution, the following privileges must be set:</p>
+ <ul>
+  <li><span style="font-family: Courier New,Courier,monospace">http://tizen.org/privilege/location</span></li>
+  <li><span style="font-family: Courier New,Courier,monospace">http://tizen.org/privilege/network.get</span></li>
+ </ul>
+
+<h2>Implementation</h2>
+<h3>Application Main View</h3>
+
+<p>The <span style="font-family: Courier New,Courier,monospace">create_base_gui()</span> function has a panel for 10 buttons and 3 entries for displaying the result.</p>
+
+<pre class="prettyprint">
+static void
+create_base_gui(appdata_s *ad)
+{
+&nbsp;&nbsp;&nbsp;Evas_Object *grid, *panel;
+&nbsp;&nbsp;&nbsp;Elm_Object_Item *nf_it;
+
+&nbsp;&nbsp;&nbsp;/* Window */
+&nbsp;&nbsp;&nbsp;ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE);
+&nbsp;&nbsp;&nbsp;elm_win_conformant_set(ad->win, EINA_TRUE);
+&nbsp;&nbsp;&nbsp;elm_win_autodel_set(ad->win, EINA_TRUE);
+&nbsp;&nbsp;&nbsp;evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL);
+
+&nbsp;&nbsp;&nbsp;/* Conformant */
+&nbsp;&nbsp;&nbsp;ad->conform = elm_conformant_add(ad->win);
+&nbsp;&nbsp;&nbsp;evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+&nbsp;&nbsp;&nbsp;elm_win_resize_object_add(ad->win, ad->conform);
+&nbsp;&nbsp;&nbsp;evas_object_show(ad->conform);
+
+&nbsp;&nbsp;&nbsp;/* Indicator */
+&nbsp;&nbsp;&nbsp;elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW);
+&nbsp;&nbsp;&nbsp;elm_win_indicator_opacity_set(ad->win, ELM_WIN_INDICATOR_OPAQUE);
+
+&nbsp;&nbsp;&nbsp;/* layout */
+&nbsp;&nbsp;&nbsp;ad->layout = elm_layout_add(ad->conform);
+&nbsp;&nbsp;&nbsp;evas_object_size_hint_weight_set(ad->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+&nbsp;&nbsp;&nbsp;elm_layout_theme_set(ad->layout, "layout", "application", "default");
+&nbsp;&nbsp;&nbsp;elm_object_content_set(ad->conform, ad->layout);
+&nbsp;&nbsp;&nbsp;evas_object_show(ad->layout);
+
+&nbsp;&nbsp;&nbsp;ad->nf = elm_naviframe_add(ad->layout);
+&nbsp;&nbsp;&nbsp;elm_object_part_content_set(ad->layout, "elm.swallow.content", ad->nf);
+&nbsp;&nbsp;&nbsp;eext_object_event_callback_add(ad->nf, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL);
+&nbsp;&nbsp;&nbsp;evas_object_show(ad->nf);
+
+&nbsp;&nbsp;&nbsp;/* Grid */
+&nbsp;&nbsp;&nbsp;grid = elm_grid_add(ad->nf);
+&nbsp;&nbsp;&nbsp;evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+&nbsp;&nbsp;&nbsp;evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
+&nbsp;&nbsp;&nbsp;elm_object_content_set(ad->nf, grid);
+
+&nbsp;&nbsp;&nbsp;/* Entry */
+&nbsp;&nbsp;&nbsp;ad->entry = create_entry(grid);
+&nbsp;&nbsp;&nbsp;elm_grid_pack(grid, ad->entry, 0, 5, 90, 10);
+
+&nbsp;&nbsp;&nbsp;ad->event_entry = create_entry(grid);
+&nbsp;&nbsp;&nbsp;elm_grid_pack(grid, ad->event_entry, 0, 15, 90, 10);
+
+&nbsp;&nbsp;&nbsp;ad->status_entry = create_entry(grid);
+&nbsp;&nbsp;&nbsp;elm_grid_pack(grid, ad->status_entry, 0, 25, 90, 10);
+
+&nbsp;&nbsp;&nbsp;/* Panel */
+&nbsp;&nbsp;&nbsp;panel = create_panel(grid, ad);
+&nbsp;&nbsp;&nbsp;elm_grid_pack(grid, panel, 0, 55, 100, 45);
+
+&nbsp;&nbsp;&nbsp;nf_it = elm_naviframe_item_push(ad->nf, "Geofence", NULL, NULL, grid, NULL);
+&nbsp;&nbsp;&nbsp;elm_naviframe_item_pop_cb_set(nf_it, win_delete_request_cb, ad);
+&nbsp;&nbsp;&nbsp;/* Show window after base gui is set up */
+&nbsp;&nbsp;&nbsp;evas_object_show(ad->win);
+}
+</pre>
+
+<p>The <span style="font-family: Courier New,Courier,monospace">create_panel_basic_content()</span> function has 10 buttons and callbacks for create and destroy button.</p>
+<pre class="prettyprint">
+static Evas_Object *
+create_panel_basic_content(Evas_Object *parent, appdata_s *ad)
+{
+&nbsp;&nbsp;&nbsp;Evas_Object *table;
+
+&nbsp;&nbsp;&nbsp;table = elm_table_add(parent);
+&nbsp;&nbsp;&nbsp;elm_table_padding_set(table, 10, 0);
+
+&nbsp;&nbsp;&nbsp;ad->create_btn = elm_button_add(table);
+&nbsp;&nbsp;&nbsp;evas_object_size_hint_weight_set(ad->create_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+&nbsp;&nbsp;&nbsp;evas_object_size_hint_align_set(ad->create_btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+&nbsp;&nbsp;&nbsp;elm_object_text_set(ad->create_btn, "<font_size=30>Create</font_size>");
+&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->create_btn, EINA_FALSE);
+&nbsp;&nbsp;&nbsp;evas_object_smart_callback_add(ad->create_btn, "clicked", clicked_create_cb, ad);
+&nbsp;&nbsp;&nbsp;evas_object_show(ad->create_btn);
+&nbsp;&nbsp;&nbsp;elm_table_pack(table, ad->create_btn, 0, 0, 1, 1);
+
+&nbsp;&nbsp;&nbsp;ad->fence_status_btn = elm_button_add(table);
+&nbsp;&nbsp;&nbsp;evas_object_size_hint_weight_set(ad->fence_status_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+&nbsp;&nbsp;&nbsp;evas_object_size_hint_align_set(ad->fence_status_btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+&nbsp;&nbsp;&nbsp;elm_object_text_set(ad->fence_status_btn, "<font_size=30>Fence Status</font_size>");
+&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->fence_status_btn, EINA_TRUE);
+&nbsp;&nbsp;&nbsp;evas_object_smart_callback_add(ad->fence_status_btn, "clicked", show_popup_cb, ad);
+&nbsp;&nbsp;&nbsp;evas_object_show(ad->fence_status_btn);
+&nbsp;&nbsp;&nbsp;elm_table_pack(table, ad->fence_status_btn, 1, 0, 1, 1);
+
+&nbsp;&nbsp;&nbsp;ad->add_fence_btn = elm_button_add(table);
+&nbsp;&nbsp;&nbsp;evas_object_size_hint_weight_set(ad->add_fence_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+&nbsp;&nbsp;&nbsp;evas_object_size_hint_align_set(ad->add_fence_btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+&nbsp;&nbsp;&nbsp;elm_object_text_set(ad->add_fence_btn, "<font_size=30>Add Fence</font_size>");
+&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->add_fence_btn, EINA_TRUE);
+&nbsp;&nbsp;&nbsp;evas_object_smart_callback_add(ad->add_fence_btn, "clicked", show_popup_cb, ad);
+&nbsp;&nbsp;&nbsp;evas_object_show(ad->add_fence_btn);
+&nbsp;&nbsp;&nbsp;elm_table_pack(table, ad->add_fence_btn, 0, 1, 1, 1);
+
+&nbsp;&nbsp;&nbsp;ad->add_place_btn = elm_button_add(table);
+&nbsp;&nbsp;&nbsp;evas_object_size_hint_weight_set(ad->add_place_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+&nbsp;&nbsp;&nbsp;evas_object_size_hint_align_set(ad->add_place_btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+&nbsp;&nbsp;&nbsp;elm_object_text_set(ad->add_place_btn, "<font_size=30>Add Place</font_size>");
+&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->add_place_btn, EINA_TRUE);
+&nbsp;&nbsp;&nbsp;evas_object_smart_callback_add(ad->add_place_btn, "clicked", show_popup_cb, ad);
+&nbsp;&nbsp;&nbsp;evas_object_show(ad->add_place_btn);
+&nbsp;&nbsp;&nbsp;elm_table_pack(table, ad->add_place_btn, 1, 1, 1, 1);
+
+&nbsp;&nbsp;&nbsp;ad->start_btn = elm_button_add(table);
+&nbsp;&nbsp;&nbsp;evas_object_size_hint_weight_set(ad->start_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+&nbsp;&nbsp;&nbsp;evas_object_size_hint_align_set(ad->start_btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+&nbsp;&nbsp;&nbsp;elm_object_text_set(ad->start_btn, "<font_size=30>Start</font_size>");
+&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->start_btn, EINA_TRUE);
+&nbsp;&nbsp;&nbsp;evas_object_smart_callback_add(ad->start_btn, "clicked", show_popup_cb, ad);
+&nbsp;&nbsp;&nbsp;evas_object_show(ad->start_btn);
+&nbsp;&nbsp;&nbsp;elm_table_pack(table, ad->start_btn, 0, 2, 1, 1);
+
+&nbsp;&nbsp;&nbsp;ad->stop_btn = elm_button_add(table);
+&nbsp;&nbsp;&nbsp;evas_object_size_hint_weight_set(ad->stop_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+&nbsp;&nbsp;&nbsp;evas_object_size_hint_align_set(ad->stop_btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+&nbsp;&nbsp;&nbsp;elm_object_text_set(ad->stop_btn, "<font_size=30>Stop</font_size>");
+&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->stop_btn, EINA_TRUE);
+&nbsp;&nbsp;&nbsp;evas_object_smart_callback_add(ad->stop_btn, "clicked", show_popup_cb, ad);
+&nbsp;&nbsp;&nbsp;evas_object_show(ad->stop_btn);
+&nbsp;&nbsp;&nbsp;elm_table_pack(table, ad->stop_btn, 1, 2, 1, 1);
+
+&nbsp;&nbsp;&nbsp;ad->remove_fence_btn = elm_button_add(table);
+&nbsp;&nbsp;&nbsp;evas_object_size_hint_weight_set(ad->remove_fence_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+&nbsp;&nbsp;&nbsp;evas_object_size_hint_align_set(ad->remove_fence_btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+&nbsp;&nbsp;&nbsp;elm_object_text_set(ad->remove_fence_btn, "<font_size=30>Remove Fence</font_size>");
+&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->remove_fence_btn, EINA_TRUE);
+&nbsp;&nbsp;&nbsp;evas_object_smart_callback_add(ad->remove_fence_btn, "clicked", show_popup_cb, ad);
+&nbsp;&nbsp;&nbsp;evas_object_show(ad->remove_fence_btn);
+&nbsp;&nbsp;&nbsp;elm_table_pack(table, ad->remove_fence_btn, 0, 3, 1, 1);
+
+&nbsp;&nbsp;&nbsp;ad->remove_place_btn = elm_button_add(table);
+&nbsp;&nbsp;&nbsp;evas_object_size_hint_weight_set(ad->remove_place_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+&nbsp;&nbsp;&nbsp;evas_object_size_hint_align_set(ad->remove_place_btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+&nbsp;&nbsp;&nbsp;elm_object_text_set(ad->remove_place_btn, "<font_size=30>Remove Place</font_size>");
+&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->remove_place_btn, EINA_TRUE);
+&nbsp;&nbsp;&nbsp;evas_object_smart_callback_add(ad->remove_place_btn, "clicked", show_popup_cb, ad);
+&nbsp;&nbsp;&nbsp;evas_object_show(ad->remove_place_btn);
+&nbsp;&nbsp;&nbsp;elm_table_pack(table, ad->remove_place_btn, 1, 3, 1, 1);
+
+&nbsp;&nbsp;&nbsp;ad->update_place_btn = elm_button_add(table);
+&nbsp;&nbsp;&nbsp;evas_object_size_hint_weight_set(ad->update_place_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+&nbsp;&nbsp;&nbsp;evas_object_size_hint_align_set(ad->update_place_btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+&nbsp;&nbsp;&nbsp;elm_object_text_set(ad->update_place_btn, "<font_size=30>Update Place</font_size>");
+&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->update_place_btn, EINA_TRUE);
+&nbsp;&nbsp;&nbsp;evas_object_smart_callback_add(ad->update_place_btn, "clicked", show_popup_cb, ad);
+&nbsp;&nbsp;&nbsp;evas_object_show(ad->update_place_btn);
+&nbsp;&nbsp;&nbsp;elm_table_pack(table, ad->update_place_btn, 0, 4, 1, 1);
+
+&nbsp;&nbsp;&nbsp;ad->destroy_btn = elm_button_add(table);
+&nbsp;&nbsp;&nbsp;evas_object_size_hint_weight_set(ad->destroy_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+&nbsp;&nbsp;&nbsp;evas_object_size_hint_align_set(ad->destroy_btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+&nbsp;&nbsp;&nbsp;elm_object_text_set(ad->destroy_btn, "<font_size=30>Destroy</font_size>");
+&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->destroy_btn, EINA_TRUE);
+&nbsp;&nbsp;&nbsp;evas_object_smart_callback_add(ad->destroy_btn, "clicked", clicked_destroy_cb, ad);
+&nbsp;&nbsp;&nbsp;evas_object_show(ad->destroy_btn);
+&nbsp;&nbsp;&nbsp;elm_table_pack(table, ad->destroy_btn, 1, 4, 1, 1);
+
+&nbsp;&nbsp;&nbsp;evas_object_show(table);
+
+&nbsp;&nbsp;&nbsp;return table;
+}</pre>
+
+<p>The <span style="font-family: Courier New,Courier,monospace">show_popup_cb()</span> function has several functions for remaining buttons.</p>
+<pre class="prettyprint">
+static void
+show_popup_cb(void *data, Evas_Object *obj, void *event_info)
+{
+&nbsp;&nbsp;&nbsp;appdata_s *ad = (appdata_s *)data;
+
+&nbsp;&nbsp;&nbsp;if (obj == ad->fence_status_btn)
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;select_fence_list(ad, get_status_cb);
+&nbsp;&nbsp;&nbsp;else if (obj == ad->add_fence_btn)
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;select_place_list(ad, add_fence_cb);
+&nbsp;&nbsp;&nbsp;else if (obj == ad->add_place_btn)
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;insert_place_name(ad, ad->add_place_btn, -1, NULL);
+&nbsp;&nbsp;&nbsp;else if (obj == ad->start_btn)
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;select_fence_list(ad, start_fence_cb);
+&nbsp;&nbsp;&nbsp;else if (obj == ad->stop_btn)
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;select_fence_list(ad, stop_fence_cb);
+&nbsp;&nbsp;&nbsp;else if (obj == ad->remove_fence_btn)
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;select_fence_list(ad, remove_fence_cb);
+&nbsp;&nbsp;&nbsp;else if (obj == ad->remove_place_btn)
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;select_place_list(ad, remove_place_cb);
+&nbsp;&nbsp;&nbsp;else if (obj == ad->update_place_btn)
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;select_place_list(ad, update_place_cb);
+}
+</pre>
+
+
+<h3>Application Operation</h3>
+<p>To manage contacts:</p>
+<ol>
+<li>
+
+<p>Create a handle of geofence-manager.</p>
+
+<pre class="prettyprint">
+static void
+clicked_create_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+&nbsp;&nbsp;&nbsp;appdata_s *ad = (appdata_s *) data;
+&nbsp;&nbsp;&nbsp;int ret = 0;
+
+&nbsp;&nbsp;&nbsp;ret = geofence_manager_create(&(ad->geo_manager));
+
+&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->entry, "<font_size=30><align=left>geofence_manager_create</align></font_size>");
+&nbsp;&nbsp;&nbsp;showError(ad->event_entry, ret);
+&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->status_entry, "<font_size=25><align=left></align></font_size>");
+
+&nbsp;&nbsp;&nbsp;if (ret == GEOFENCE_MANAGER_ERROR_NONE) {
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->create_btn, EINA_TRUE);
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->fence_status_btn, EINA_FALSE);
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->add_fence_btn, EINA_FALSE);
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->add_place_btn, EINA_FALSE);
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->start_btn, EINA_FALSE);
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->stop_btn, EINA_FALSE);
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->remove_fence_btn, EINA_FALSE);
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->remove_place_btn, EINA_FALSE);
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->update_place_btn, EINA_FALSE);
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->destroy_btn, EINA_FALSE);
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;geofence_manager_set_geofence_event_cb(ad->geo_manager, show_event_cb, ad);
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;geofence_manager_set_geofence_state_changed_cb(ad->geo_manager, show_state_changed_cb, ad);
+&nbsp;&nbsp;&nbsp;}
+}
+</pre>
+</li>
+
+<li>
+<p>Destroy the handle of geofence-manager.</p>
+
+<pre class="prettyprint">
+static void
+clicked_destroy_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+&nbsp;&nbsp;&nbsp;appdata_s *ad = (appdata_s *) data;
+&nbsp;&nbsp;&nbsp;int ret = 0;
+
+&nbsp;&nbsp;&nbsp;geofence_manager_unset_geofence_event_cb(ad->geo_manager);
+&nbsp;&nbsp;&nbsp;geofence_manager_unset_geofence_state_changed_cb(ad->geo_manager);
+
+&nbsp;&nbsp;&nbsp;ret = geofence_manager_destroy(ad->geo_manager);
+
+&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->entry, "<font_size=30><align=left>geofence_manager_destroy</align></font_size>");
+       showError(ad->event_entry, ret);
+       elm_entry_entry_set(ad->status_entry, "<font_size=25><align=left></align></font_size>");
+
+&nbsp;&nbsp;&nbsp;if (ret == GEOFENCE_MANAGER_ERROR_NONE) {
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->create_btn, EINA_FALSE);
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->fence_status_btn, EINA_TRUE);
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->add_fence_btn, EINA_TRUE);
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->add_place_btn, EINA_TRUE);
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->start_btn, EINA_TRUE);
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->stop_btn, EINA_TRUE);
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->remove_fence_btn, EINA_TRUE);
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->remove_place_btn, EINA_TRUE);
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->update_place_btn, EINA_TRUE);
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_object_disabled_set(ad->destroy_btn, EINA_TRUE);
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ad->geo_manager = NULL;
+&nbsp;&nbsp;&nbsp;}
+}
+</pre>
+</li>
+
+<li>
+<p>Get a status of the selected fence.</p>
+
+<pre class="prettyprint">
+static void
+get_status_cb(void *data, Evas_Object *obj, void *event_info)
+{
+&nbsp;&nbsp;&nbsp;appdata_s *ad = evas_object_data_get(obj, "app_data");
+&nbsp;&nbsp;&nbsp;int geofence_id = (int) data;
+&nbsp;&nbsp;&nbsp;geofence_status_h status = NULL;
+&nbsp;&nbsp;&nbsp;geofence_state_e state;
+&nbsp;&nbsp;&nbsp;int seconds = 0;
+&nbsp;&nbsp;&nbsp;int ret = 0;
+&nbsp;&nbsp;&nbsp;char buf[50] = {};
+&nbsp;&nbsp;&nbsp;char *state_str[] = {"UNCERTAIN", "IN", "OUT"};
+
+&nbsp;&nbsp;&nbsp;evas_object_del(ad->popup);
+
+&nbsp;&nbsp;&nbsp;ret = geofence_status_create(geofence_id, &status);
+&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->entry, "<font_size=30><align=left>geofence_status_create</align></font_size>");
+&nbsp;&nbsp;&nbsp;showError(ad->event_entry, ret);
+&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->status_entry, "<font_size=25><align=left></align></font_size>");
+
+&nbsp;&nbsp;&nbsp;if (ret != GEOFENCE_MANAGER_ERROR_NONE)
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;
+
+&nbsp;&nbsp;&nbsp;ret = geofence_status_get_state(status, &state);
+&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->entry, "<font_size=30><align=left>geofence_status_get_state</align></font_size>");
+&nbsp;&nbsp;&nbsp;showError(ad->event_entry, ret);
+&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->status_entry, "<font_size=25><align=left></align></font_size>");
+
+&nbsp;&nbsp;&nbsp;ret = geofence_status_get_duration(status, &seconds);
+&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->entry, "<font_size=30><align=left>geofence_status_get_duration</align></font_size>");
+&nbsp;&nbsp;&nbsp;showError(ad->event_entry, ret);
+&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->status_entry, "<font_size=25><align=left></align></font_size>");
+
+&nbsp;&nbsp;&nbsp;if (ret != GEOFENCE_MANAGER_ERROR_NONE)
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;
+
+&nbsp;&nbsp;&nbsp;ret = geofence_status_destroy(status);
+&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->entry, "<font_size=30><align=left>geofence_status_destroy</align></font_size>");
+&nbsp;&nbsp;&nbsp;showError(ad->event_entry, ret);
+&nbsp;&nbsp;&nbsp;snprintf(buf, sizeof(buf), "Fence ID: %d, State: %s, Duration: %d", geofence_id, state_str[state], seconds);
+&nbsp;&nbsp;&nbsp;elm_entry_entry_append(ad->status_entry, "<font_size=25><align=left>");
+&nbsp;&nbsp;&nbsp;elm_entry_entry_append(ad->status_entry, buf);
+&nbsp;&nbsp;&nbsp;elm_entry_entry_append(ad->status_entry, "</align></font_size>");
+}
+</pre>
+</li>
+
+<li>
+<p>Add a fence according to the input data.</p>
+
+<pre class="prettyprint">
+static void
+popup_method_value_cb(void *data, Evas_Object *obj, void *event_info)
+{
+&nbsp;&nbsp;&nbsp;appdata_s *ad = evas_object_data_get(obj, "app_data");
+&nbsp;&nbsp;&nbsp;int place_id = (int)evas_object_data_get(obj, "place_id");;
+&nbsp;&nbsp;&nbsp;int method = (int)data;
+
+&nbsp;&nbsp;&nbsp;const char *value = elm_entry_entry_get(ad->gen_entry);
+&nbsp;&nbsp;&nbsp;const char *value_nd = elm_entry_entry_get(ad->gen_entry_nd);
+
+&nbsp;&nbsp;&nbsp;geofence_h fence = NULL;
+&nbsp;&nbsp;&nbsp;double latitude = 0.0, longitude = 0.0;
+&nbsp;&nbsp;&nbsp;int geofence_id = -1;
+&nbsp;&nbsp;&nbsp;int ret = 0;
+
+&nbsp;&nbsp;&nbsp;if (!strcmp(value, "")) {
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;show_toast_popup(ad, "Empty Value");
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;
+&nbsp;&nbsp;&nbsp;}
+&nbsp;&nbsp;&nbsp;if (method == METHOD_GPS) {
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (!strcmp(value_nd, "")) {
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;show_toast_popup(ad, "Empty Value");
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
+&nbsp;&nbsp;&nbsp;}
+
+&nbsp;&nbsp;&nbsp;switch (method) {
+&nbsp;&nbsp;&nbsp;case METHOD_GPS:
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;latitude = atof(value);
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;longitude = atof(value_nd);
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ret = geofence_create_geopoint(place_id, latitude, longitude, 200, "Dubai MR", &fence);
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->entry, "<font_size=30><align=left>geofence_create_geopoint</align></font_size>");
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;
+&nbsp;&nbsp;&nbsp;case METHOD_WIFI:
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ret = geofence_create_wifi(place_id, value, "Dubai MR", &fence);
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->entry, "<font_size=30><align=left>geofence_create_wifi</align></font_size>");
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;
+&nbsp;&nbsp;&nbsp;case METHOD_BT:
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ret = geofence_create_bluetooth(place_id, value, "Dubai MR", &fence);
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->entry, "<font_size=30><align=left>geofence_create_bluetooth</align></font_size>");
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;
+&nbsp;&nbsp;&nbsp;default:
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;
+&nbsp;&nbsp;&nbsp;}
+&nbsp;&nbsp;&nbsp;showError(ad->event_entry, ret);
+&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->status_entry, "<font_size=25><align=left></align></font_size>");
+
+&nbsp;&nbsp;&nbsp;ret = geofence_manager_add_fence(ad->geo_manager, fence, &geofence_id);
+&nbsp;&nbsp;&nbsp;showError(ad->event_entry, ret);
+
+&nbsp;&nbsp;&nbsp;evas_object_del(ad->popup);
+}
+</pre>
+</li>
+
+<li>
+<p>Remove the selected fence.</p>
+
+<pre class="prettyprint">
+static void
+remove_fence_cb(void *data, Evas_Object *obj, void *event_info)
+{
+&nbsp;&nbsp;&nbsp;appdata_s *ad = evas_object_data_get(obj, "app_data");
+&nbsp;&nbsp;&nbsp;int fence_id = (int) data;
+&nbsp;&nbsp;&nbsp;int ret = 0;
+
+&nbsp;&nbsp;&nbsp;evas_object_del(ad->popup);
+
+&nbsp;&nbsp;&nbsp;ret = geofence_manager_remove_fence(ad->geo_manager, fence_id);
+
+&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->entry, "<font_size=30><align=left>geofence_manager_remove_fence</align></font_size>");
+&nbsp;&nbsp;&nbsp;showError(ad->event_entry, ret);
+&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->status_entry, "<font_size=25><align=left></align></font_size>");
+}
+</pre>
+</li>
+
+<li>
+<p>Add a place or rename the selected place.</p>
+
+<pre class="prettyprint">
+static void
+popup_place_name_cb(void *data, Evas_Object *obj, void *event_info)
+{
+&nbsp;&nbsp;&nbsp;appdata_s *ad = evas_object_data_get(obj, "app_data");
+&nbsp;&nbsp;&nbsp;int ret = 0;
+&nbsp;&nbsp;&nbsp;int place_id = (int)data;
+&nbsp;&nbsp;&nbsp;const char *place_name = elm_entry_entry_get(ad->gen_entry);
+
+&nbsp;&nbsp;&nbsp;if (!strcmp(place_name, "")) {
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;show_toast_popup(ad, "Empty Value");
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;
+&nbsp;&nbsp;&nbsp;}
+
+&nbsp;&nbsp;&nbsp;if (place_id < 0) {
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ret = geofence_manager_add_place(ad->geo_manager, place_name, &place_id);
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->entry, "<font_size=30><align=left>geofence_manager_add_place</align></font_size>");
+&nbsp;&nbsp;&nbsp;} else {
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ret = geofence_manager_update_place(ad->geo_manager, place_id, place_name);
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->entry, "<font_size=30><align=left>geofence_manager_update_place</align></font_size>");
+&nbsp;&nbsp;&nbsp;}
+
+&nbsp;&nbsp;&nbsp;showError(ad->event_entry, ret);
+
+&nbsp;&nbsp;&nbsp;if (place_id > 0 && place_id <= 3)
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->status_entry, "<font_size=25><align=left>The renaming of default place is impossible</align></font_size>");
+&nbsp;&nbsp;&nbsp;else
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->status_entry, "<font_size=25><align=left></align></font_size>");
+
+&nbsp;&nbsp;&nbsp;evas_object_del(ad->popup);
+}
+</pre>
+</li>
+
+<li>
+<p>Remove the selected place.</p>
+
+<pre class="prettyprint">
+static void
+remove_place_cb(void *data, Evas_Object *obj, void *event_info)
+{
+&nbsp;&nbsp;&nbsp;appdata_s *ad = evas_object_data_get(obj, "app_data");
+&nbsp;&nbsp;&nbsp;int place_id = (int) data;
+&nbsp;&nbsp;&nbsp;int ret = 0;
+
+&nbsp;&nbsp;&nbsp;evas_object_del(ad->popup);
+
+&nbsp;&nbsp;&nbsp;ret = geofence_manager_remove_place(ad->geo_manager, place_id);
+
+&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->entry, "<font_size=30><align=left>geofence_manager_remove_place</align></font_size>");
+&nbsp;&nbsp;&nbsp;showError(ad->event_entry, ret);
+&nbsp;&nbsp;&nbsp;if (place_id <= 3)
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->status_entry, "<font_size=25><align=left>The deletion of default place is impossible</align></font_size>");
+&nbsp;&nbsp;&nbsp;else
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->status_entry, "<font_size=25><align=left></align></font_size>");
+}
+</pre>
+</li>
+
+<li>
+<p>Start the selected fence.</p>
+
+<pre class="prettyprint">
+static void
+start_fence_cb(void *data, Evas_Object *obj, void *event_info)
+{
+&nbsp;&nbsp;&nbsp;appdata_s *ad = evas_object_data_get(obj, "app_data");
+&nbsp;&nbsp;&nbsp;int fence_id = (int) data;
+&nbsp;&nbsp;&nbsp;int ret = 0;
+
+&nbsp;&nbsp;&nbsp;evas_object_del(ad->popup);
+
+&nbsp;&nbsp;&nbsp;ret = geofence_manager_start(ad->geo_manager, fence_id);
+
+&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->entry, "<font_size=30><align=left>geofence_manager_start</align></font_size>");
+&nbsp;&nbsp;&nbsp;showError(ad->event_entry, ret);
+&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->status_entry, "<font_size=25><align=left></align></font_size>");
+}
+</pre>
+</li>
+
+<li>
+<p>Stop the selected fence.</p>
+
+<pre class="prettyprint">
+static void
+stop_fence_cb(void *data, Evas_Object *obj, void *event_info)
+{
+&nbsp;&nbsp;&nbsp;appdata_s *ad = evas_object_data_get(obj, "app_data");
+&nbsp;&nbsp;&nbsp;int fence_id = (int) data;
+&nbsp;&nbsp;&nbsp;int ret = 0;
+
+&nbsp;&nbsp;&nbsp;evas_object_del(ad->popup);
+
+&nbsp;&nbsp;&nbsp;ret = geofence_manager_stop(ad->geo_manager, fence_id);
+
+&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->entry, "<font_size=30><align=left>geofence_manager_stop</align></font_size>");
+&nbsp;&nbsp;&nbsp;showError(ad->event_entry, ret);
+&nbsp;&nbsp;&nbsp;elm_entry_entry_set(ad->status_entry, "<font_size=25><align=left></align></font_size>");
+}
+</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>