1 #include "sticker_info.h"
2 #include <sticker_provider.h>
3 #include <app_common.h>
9 static sticker_provider_h sticker_provider = NULL;
12 set_sticker_data(sticker_data_uri_type_e type, const char* uri, const char* keyword,
13 int len, const char* group, const char* thumbnail, const char* description)
15 sticker_data_h sticker_data;
18 /* Creates a Sticker data handle */
19 ret = sticker_data_create(&sticker_data);
20 if (ret != STICKER_ERROR_NONE) {
22 LOGE("Failed to create sticker data");
25 /* Sets the URI and URI type of the sticker */
26 ret = sticker_data_set_uri(sticker_data, type, uri);
27 if (ret != STICKER_ERROR_NONE) {
29 LOGE("Failed to set uri");
32 //for (int i = 0; i < len; i++)
34 /* Adds a keyword of the sticker to the list */
35 ret = sticker_data_add_keyword(sticker_data, keyword);
36 if (ret != STICKER_ERROR_NONE) {
38 LOGE("Failed to add keyword");
42 /* Sets the group name of the sticker */
43 ret = sticker_data_set_group_name(sticker_data, group);
44 if (ret != STICKER_ERROR_NONE) {
46 LOGE("Failed to set group name");
49 /* Sets the thumbnail local path of the sticker */
51 ret = sticker_data_set_thumbnail(sticker_data, thumbnail);
52 if (ret != STICKER_ERROR_NONE) {
54 LOGE("Failed to set thumbnail");
58 /* Sets the description of the sticker */
59 ret = sticker_data_set_description(sticker_data, description);
60 if (ret != STICKER_ERROR_NONE) {
62 LOGE("Failed to set description");
69 insert_sticker_data(const char *filepath, const char *keyword, const char *group, const char *desc)
71 sticker_data_h data_handle;
74 data_handle = set_sticker_data(STICKER_DATA_URI_LOCAL_PATH, filepath, keyword, 1, group, NULL, desc);
76 ret = sticker_provider_insert_data(sticker_provider, data_handle);
77 if (ret != STICKER_ERROR_NONE) {
78 LOGE("Failed to insert data. error code : %x. message : %s", ret, get_error_message(ret));
81 LOGI("Succeeded to insert data");
84 /* Destroys a sticker data handle */
85 ret = sticker_data_destroy(data_handle);
86 if (ret != STICKER_ERROR_NONE) {
88 LOGE("Failed to destroy sticker data");
92 int create_sticker_provider_handle(void)
95 ret = sticker_provider_create(&sticker_provider);
96 if (ret != STICKER_ERROR_NONE) {
98 LOGE("Failed to create sticker provider");
104 void destroy_sticker_provider_handle(void)
106 sticker_provider_destroy(sticker_provider);
107 sticker_provider = NULL;