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)
16 sticker_data_h sticker_data;
19 /* Creates a Sticker data handle */
20 ret = sticker_data_create(&sticker_data);
21 if (ret != STICKER_ERROR_NONE) {
23 LOGE("Failed to create sticker data");
26 /* Sets the URI and URI type of the sticker */
27 ret = sticker_data_set_uri(sticker_data, type, uri);
28 if (ret != STICKER_ERROR_NONE) {
30 LOGE("Failed to set uri");
33 //for (int i = 0; i < len; i++)
35 /* Adds a keyword of the sticker to the list */
36 ret = sticker_data_add_keyword(sticker_data, keyword);
37 if (ret != STICKER_ERROR_NONE) {
39 LOGE("Failed to add keyword");
43 /* Sets the group name of the sticker */
44 ret = sticker_data_set_group_name(sticker_data, group);
45 if (ret != STICKER_ERROR_NONE) {
47 LOGE("Failed to set group name");
50 /* Sets the thumbnail local path of the sticker */
52 ret = sticker_data_set_thumbnail(sticker_data, thumbnail);
53 if (ret != STICKER_ERROR_NONE) {
55 LOGE("Failed to set thumbnail");
59 /* Sets the description of the sticker */
60 ret = sticker_data_set_description(sticker_data, description);
61 if (ret != STICKER_ERROR_NONE) {
63 LOGE("Failed to set description");
70 insert_sticker_data(const char *filepath, const char *keyword, const char *group, const char *desc)
72 sticker_data_h data_handle;
75 data_handle = set_sticker_data(STICKER_DATA_URI_LOCAL_PATH, filepath, keyword, 1, group, NULL, desc);
77 ret = sticker_provider_insert_data(sticker_provider, data_handle);
78 if (ret != STICKER_ERROR_NONE) {
79 LOGE("Failed to insert data. error code : %x. message : %s", ret, get_error_message(ret));
82 LOGI("Succeeded to insert data");
85 /* Destroys a sticker data handle */
86 ret = sticker_data_destroy(data_handle);
87 if (ret != STICKER_ERROR_NONE) {
89 LOGE("Failed to destroy sticker data");
93 int create_sticker_provider_handle(void)
96 ret = sticker_provider_create(&sticker_provider);
97 if (ret != STICKER_ERROR_NONE) {
99 LOGE("Failed to create sticker provider");
105 void destroy_sticker_provider_handle(void)
107 sticker_provider_destroy(sticker_provider);
108 sticker_provider = NULL;