Update package version to 0.1.56
[platform/core/uifw/capi-ui-sticker.git] / receiver / src / main.cpp
index c959151..8e04807 100644 (file)
@@ -29,6 +29,7 @@
 #include "log.h"
 #include "config.h"
 #include "receiver_preference.h"
+#include "sticker_info.h"
 
 using namespace std;
 
@@ -55,6 +56,8 @@ static bool app_create(void *data)
         }
     }
 
+    create_sticker_provider_handle();
+
     return true;
 }
 
@@ -98,13 +101,15 @@ static bool check_sync_time_condition()
         }
 
         // compare time
-        LOGD("current time : %f, last_sync_time : %f", ecore_time_get(), last_sync_time);
+        LOGD("current time : %f, last_sync_time : %f", ecore_time_unix_get(), last_sync_time);
 
-        if (ecore_time_get() - last_sync_time > MAX_WAIT_TIME) {
+        if (ecore_time_unix_get() - last_sync_time > MAX_WAIT_TIME) {
+            LOGD("Starting manual synchronization");
+            initialize_sap();
             request_show_sync_notification();
             result = false;
         } else {
-            if (ecore_time_get() - last_sync_time > SYNC_INTERVAL)
+            if (ecore_time_unix_get() - last_sync_time > SYNC_INTERVAL)
                 result = true;
             else
                 result = false;
@@ -155,6 +160,7 @@ static void app_control(app_control_h app_control, void *data)
                             if (!is_init_sap()) {
                                 if (check_sync_time_condition()) {
                                     if (check_battery_condition()) {
+                                        LOGD("Starting auto synchronization");
                                         initialize_sap();
                                         request_all_sticker_data("auto", "input");
                                     }
@@ -240,6 +246,7 @@ static void app_terminate(void *data)
 {
     /* Release all resources. */
     LOGD("");
+    destroy_sticker_provider_handle();
     deinitialize_sap();
 }