4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
22 #ifndef __NOTIFICATION_H__
23 #define __NOTIFICATION_H__
28 #include <notification_error.h>
29 #include <notification_type.h>
30 #include <notification_list.h>
37 * @defgroup NOTIFICATION_LIBRARY Notification Library
38 * @brief This notification library provides UI notification event. Inserted notification event is displaying Notification Tray, Indicator, etc.
42 * @ingroup NOTIFICATION_LIBRARY
43 * @defgroup NOTIFICATION notification core API
44 * @brief Notification core API
48 * @addtogroup NOTIFICATION
53 * @brief This function will be deprecated.
54 * @see notification_set_image()
57 notification_error_e notification_set_icon(notification_h noti,
58 const char *icon_path);
61 * @brief This function will be deprecated.
62 * @see notification_get_image()
65 notification_error_e notification_get_icon(notification_h noti,
69 * @brief This function set image path according to type.
72 * @param[in] noti notification handle
73 * @param[in] type notification image type
74 * @param[in] image_path image file full path
75 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
76 * @retval NOTIFICATION_ERROR_NONE - success
77 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
78 * @pre Notification handle should be created by notification_new()
80 * @see #notification_image_type_e
81 * @see notification_new()
84 #include <notification.h>
87 notification_h noti = NULL;
88 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
90 noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
95 noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, APP_IMAGE_FULL_PATH);
96 if(noti_err != NOTIFICATION_ERROR_NONE) {
97 notification_free(noti);
103 notification_error_e notification_set_image(notification_h noti,
104 notification_image_type_e type,
105 const char *image_path);
108 * @brief This function get image path according to type.
110 * @remarks Do not free image_path. It will be freed when notification_free() or notification_free_list().
111 * @param[in] noti notification handle
112 * @param[in] type notification image type
113 * @param[out] image_path image file full path
114 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
115 * @retval NOTIFICATION_ERROR_NONE - success
116 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
117 * @pre Notification handle should be created by notification_new()
119 * @see #notification_image_type_e
120 * @see notification_new()
123 #include <notification.h>
126 char *image_path = NULL;
127 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
129 noti_err = notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, &image_path);
130 if(noti_err != NOTIFICATION_ERROR_NONE) {
136 notification_error_e notification_get_image(notification_h noti,
137 notification_image_type_e type,
141 * @brief This function set time infomation.
142 * @details If input_time is 0, time information is set by current time.
144 * @param[in] noti notification handle
145 * @param[in] input_time input time
146 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
147 * @retval NOTIFICATION_ERROR_NONE - success
148 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
149 * @pre Notification handle should be created by notification_new()
151 * @see notification_new()
154 #include <notification.h>
157 notification_h noti = NULL;
158 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
160 noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
165 noti_err = notification_set_time(noti, time(NULL));
166 if(noti_err != NOTIFICATION_ERROR_NONE) {
167 notification_free(noti);
173 notification_error_e notification_set_time(notification_h noti,
177 * @brief This function get time information.
178 * @details If ret_time is 0, time information is not set before.
180 * @param[in] noti notification handle
181 * @param[out] ret_time return time value
182 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
183 * @retval NOTIFICATION_ERROR_NONE - success
184 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
185 * @pre Notification handle should be created by notification_new()
187 * @see notification_new()
190 #include <notification.h>
194 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
196 noti_err = notification_get_time(noti, &ret_time);
197 if(noti_err != NOTIFICATION_ERROR_NONE) {
203 notification_error_e notification_get_time(notification_h noti,
207 * @brief This function get insert time information.
208 * @details If ret_time is 0, this notification data is not inserted before.
210 * @param[in] noti notification handle
211 * @param[out] ret_time return time value
212 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
213 * @retval NOTIFICATION_ERROR_NONE - success
214 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
220 #include <notification.h>
224 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
226 noti_err = notification_get_insert_time(noti, &ret_time);
227 if(noti_err != NOTIFICATION_ERROR_NONE) {
233 notification_error_e notification_get_insert_time(notification_h noti,
237 * @brief This function will be deprecated.
238 * @see notification_set_text()
241 notification_error_e notification_set_title(notification_h noti,
243 const char *loc_title);
246 * @brief This function will be deprecated.
247 * @see notification_get_text()
250 notification_error_e notification_get_title(notification_h noti,
255 * @brief This function will be deprecated.
256 * @see notification_set_text()
259 notification_error_e notification_set_group_title(const char *pkgname,
262 const char *loc_title,
263 notification_count_display_type_e
267 * @brief This function will be deprecated.
268 * @see notification_get_text()
271 notification_error_e notification_get_group_title(const char *pkgname,
275 notification_count_display_type_e *count_display);
278 * @brief This function will be deprecated.
279 * @see notification_set_text()
282 notification_error_e notification_set_content(notification_h noti,
284 const char *loc_content);
287 * @brief This function will be deprecated.
288 * @see notification_get_text()
291 notification_error_e notification_get_content(notification_h noti,
296 * @brief This function will be deprecated.
297 * @see notification_set_text()
300 notification_error_e notification_set_default_content(notification_h noti,
302 const char *loc_content);
305 * @brief This function will be deprecated.
306 * @see notification_get_text()
309 notification_error_e notification_get_default_content(notification_h noti,
314 * @brief This function will be deprecated.
315 * @see notification_set_text()
318 notification_error_e notification_set_group_content(const char *pkgname,
321 const char *loc_content,
322 notification_count_display_type_e count_display);
325 * @brief This function will be deprecated.
326 * @see notification_get_text()
329 notification_error_e notification_get_group_content(const char *pkgname,
333 notification_count_display_type_e *count_display);
336 * @brief This function set text.
337 * @details Set title, content string. If text is formated data(only support %d, %f, %s), type - value pair should be set.
338 * If %d, type NOTIFICATION_VARIABLE_TYPE_INT and value is integer value.
339 * If %f, type NOTIFICATION_VARIABLE_TYPE_DOUBLE and value is double value.
340 * If %s, type NOTIFICATION_VARIABLE_TYPE_STRING and value is character string.
341 * If type is NOTIFICATION_VARIABLE_TYPE_COUNT, notification count is displaying with text.
342 * If value is NOTIFICATION_COUNT_POS_LEFT, count is displaying at the left of the text.
343 * If value is NOTIFICATION_COUNT_POS_IN, count is displaying in the text that text has %d format.
344 * If value is NOTIFICATION_COUNT_POS_RIGHT, count is displaying at the right of the text.
345 * Variable parameter should be terminated NOTIFICATION_VARIABLE_TYPE_NONE.
347 * @param[in] noti notification handle
348 * @param[in] type notification text type
349 * @param[in] text basic text
350 * @param[in] key text key for localization
351 * @param[in] args_type variable parameter that type - value pair.
352 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
353 * @retval NOTIFICATION_ERROR_NONE - success
354 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
355 * @pre notification handle should be created by notification_new().
360 #include <notification.h>
363 notification_h noti = NULL;
364 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
366 noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
371 noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, "I'm Title", "IDS_APP_BODY_IM_TITLE", NOTIFICATION_VARIABLE_TYPE_NONE);
372 if(noti_err != NOTIFICATION_ERROR_NONE) {
373 notification_free(noti);
379 notification_error_e notification_set_text(notification_h noti,
380 notification_text_type_e type,
386 * @brief This function get text.
389 * @param[in] noti notification handle
390 * @param[in] type notification text type.
391 * @param[out] text text
392 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
393 * @retval NOTIFICATION_ERROR_NONE - success
394 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
400 #include <notification.h>
403 notification_h noti = NULL;
404 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
407 noti_err = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, &text);
408 if(noti_err != NOTIFICATION_ERROR_NONE) {
414 notification_error_e notification_get_text(notification_h noti,
415 notification_text_type_e type,
419 * @brief This function set text domain.
422 * @param[in] noti notification handle
423 * @param[in] domain text domain
424 * @param[in] dir text dir
425 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
426 * @retval NOTIFICATION_ERROR_NONE - success
427 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
433 #include <notification.h>
436 notification_h noti = NULL;
437 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
439 noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
444 noti_err = notification_set_text_domain(noti, PACKAGE, LOCALEDIR);
445 if(noti_err != NOTIFICATION_ERROR_NONE) {
446 notification_free(noti);
452 notification_error_e notification_set_text_domain(notification_h noti,
457 * @brief This function get text domain.
459 * @remarks Do not free returned domain and dir. These are freed when notification_free or notification_free_list.
460 * @param[in] noti notification handle
461 * @param[out] domain domain
462 * @param[out] dir locale dir
463 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
464 * @retval NOTIFICATION_ERROR_NONE - success
465 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
471 #include <notification.h>
474 notification_h noti = NULL;
475 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
479 noti_err = notification_get_text_domain(noti, &domain, &dir);
480 if(noti_err != NOTIFICATION_ERROR_NONE) {
486 notification_error_e notification_get_text_domain(notification_h noti,
491 * @brief This function set notification sound.
494 * @param[in] noti notification handle
495 * @param[in] type notification sound type
496 * @param[in] path user sound file path
497 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
498 * @retval NOTIFICATION_ERROR_NONE - success
499 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
505 #include <notification.h>
508 notification_h noti = NULL;
509 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
511 noti_err = notification_set_sound(noti, NOTIFICATION_SOUND_TYPE_DEFAULT, NULL);
512 if(noti_err != NOTIFICATION_ERROR_NONE) {
518 notification_error_e notification_set_sound(notification_h noti,
519 notification_sound_type_e type,
523 * @brief This function get notification sound.
526 * @param[in] noti notification handle
527 * @param[out] type notification sound type
528 * @param[out] path user sound file path
529 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
530 * @retval NOTIFICATION_ERROR_NONE - success
531 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
537 #include <notification.h>
540 notification_h noti = NULL;
541 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
542 notification_sound_type_e type = NOTIFICATION_SOUND_TYPE_NONE;
544 noti_err = notification_get_sound(noti, &type, NULL);
545 if(noti_err != NOTIFICATION_ERROR_NONE) {
551 notification_error_e notification_get_sound(notification_h noti,
552 notification_sound_type_e *type,
556 * @brief This function set notification vibration.
559 * @param[in] noti notification handle
560 * @param[in] type notification vibration type
561 * @param[in] path user vibration file path
562 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
563 * @retval NOTIFICATION_ERROR_NONE - success
564 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
570 #include <notification.h>
573 notification_h noti = NULL;
574 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
576 noti_err = notification_set_vibration(noti, NOTIFICATION_VIBRATION_TYPE_DEFAULT, NULL);
577 if(noti_err != NOTIFICATION_ERROR_NONE) {
583 notification_error_e notification_set_vibration(notification_h noti,
584 notification_vibration_type_e type,
588 * @brief This function get notification vibration.
591 * @param[in] noti notification handle
592 * @param[out] type notification sound type
593 * @param[out] path user vibration file path
594 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
595 * @retval NOTIFICATION_ERROR_NONE - success
596 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
602 #include <notification.h>
605 notification_h noti = NULL;
606 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
607 notification_vibration_type_e type = NOTIFICATION_VIBRATION_TYPE_NONE;
609 noti_err = notification_get_vibration(noti, &type, NULL);
610 if(noti_err != NOTIFICATION_ERROR_NONE) {
616 notification_error_e notification_get_vibration(notification_h noti,
617 notification_vibration_type_e *type,
621 * @brief This function will be deprecated.
622 * @see notification_set_execute_option()
625 notification_error_e notification_set_application(notification_h noti, const char *pkgname); /* Do not use this */
628 * @brief This function will be deprecated.
629 * @see notification_get_execute_option()
632 notification_error_e notification_get_application(notification_h noti, char **pkgname); /* Do not use this */
635 * @brief This function will be deprecated.
636 * @see notification_set_execute_option()
639 notification_error_e notification_set_args(notification_h noti, bundle * args, bundle * group_args); /* Do not use this */
642 * @brief This function will be deprecated.
643 * @see notification_get_execute_option()
646 notification_error_e notification_get_args(notification_h noti, bundle ** args, bundle ** group_args); /* Do not use this */
649 * @brief This function will be deprecated.
650 * @see notification_set_execute_option()
653 notification_error_e notification_set_service_data(notification_h noti,
654 bundle *service_data,
655 bundle *group_service_data);
658 * @brief This function will be deprecated.
659 * @see notification_get_execute_option()
662 notification_error_e notification_get_service_data(notification_h noti,
663 bundle **service_data,
664 bundle **group_service_data);
667 * @brief This function set execute option.
668 * @details When notification data selected in display application, application launched by appsvc_run_service with service_handle.
670 * @param[in] noti notification handle
671 * @param[in] type notification execute type
672 * @param[in] text basic text for button
673 * @param[in] key value for localizaed text
674 * @param[in] service_handle appsvc bundle data
675 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
676 * @retval NOTIFICATION_ERROR_NONE - success
677 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
682 notification_error_e notification_set_execute_option(notification_h noti,
683 notification_execute_type_e type,
686 bundle *service_handle);
689 * @brief This function get execute option.
692 * @param[in] noti notification handle
693 * @param[in] type notification execute type
694 * @param[out] text text for button
695 * @param[out] service_handle appsvc bundle data
696 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
697 * @retval NOTIFICATION_ERROR_NONE - success
698 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
704 #include <notification.h>
707 notification_h noti = NULL;
708 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
713 noti_err = notification_get_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, &b);
714 if(noti_err != NOTIFICATION_ERROR_NONE) {
715 notification_free(noti);
721 notification_error_e notification_get_execute_option(notification_h noti,
722 notification_execute_type_e type,
724 bundle **service_handle);
727 * @brief This function set notification property.
730 * @param[in] noti notification handle
731 * @param[in] flags property with | operation
732 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
733 * @retval NOTIFICATION_ERROR_NONE - success
734 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
740 #include <notification.h>
743 notification_h noti = NULL;
744 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
747 noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
752 noti_err = notification_set_property(noti, NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE | NOTIFICATION_PROP_DISABLE_APP_LAUNCH);
753 if(noti_err != NOTIFICATION_ERROR_NONE) {
754 notification_free(noti);
760 notification_error_e notification_set_property(notification_h noti,
764 * @brief This function get notification property.
767 * @param[in] noti notification handle
768 * @param[out] flags notification property
769 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
770 * @retval NOTIFICATION_ERROR_NONE - success
771 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
777 #include <notification.h>
780 notification_h noti = NULL;
781 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
784 noti_err = notification_get_property(noti, &flags);
785 if(noti_err != NOTIFICATION_ERROR_NONE) {
791 notification_error_e notification_get_property(notification_h noti,
795 * @brief This function set display application list.
796 * @details All display application is enable(NOTIFICATION_DISPLAY_APP_ALL) if you are not call this API.
798 * @param[in] noti notification handle
799 * @param[in] applist with | operation
800 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
801 * @retval NOTIFICATION_ERROR_NONE - success
802 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
808 #include <notification.h>
811 notification_h noti = NULL;
812 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
815 noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
820 noti_err = notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_TICKER);
821 if(noti_err != NOTIFICATION_ERROR_NONE) {
822 notification_free(noti);
829 notification_error_e notification_set_display_applist(notification_h noti,
833 * @brief This function get display application list.
836 * @param[in] noti notification handle
837 * @param[out] applist display application list.
838 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
839 * @retval NOTIFICATION_ERROR_NONE - success
840 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
846 #include <notification.h>
849 notification_h noti = NULL;
850 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
853 noti_err = notification_get_display_applist(noti, &applist);
854 if(noti_err != NOTIFICATION_ERROR_NONE) {
860 notification_error_e notification_get_display_applist(notification_h noti,
864 * @brief This function set initial size for ongoing type.
865 * @details After notification_insert, it does not upate size. If you want to update size, please call notification_update_size().
867 * @param[in] noti notification handle
868 * @param[in] size double type size.
869 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
870 * @retval NOTIFICATION_ERROR_NONE - success
871 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
877 #include <notification.h>
880 notification_h noti = NULL;
881 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
883 noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
888 noti_err = notification_set_size(noti, 0.0);
889 if(noti_err != NOTIFICATION_ERROR_NONE) {
890 notification_free(noti);
896 notification_error_e notification_set_size(notification_h noti,
900 * @brief This function get progress size.
903 * @param[in] noti notification handle
904 * @param[out] size progress size
905 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
906 * @retval NOTIFICATION_ERROR_NONE - success
907 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
913 #include <notification.h>
916 notification_h noti = NULL;
917 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
920 noti_err = notification_get_size(noti, &size);
921 if(noti_err != NOTIFICATION_ERROR_NONE) {
927 notification_error_e notification_get_size(notification_h noti,
931 * @brief This function set initial progress for ongoing type.
932 * @details After notification_insert, it does not upate progress. If you want to update progress, please call notification_update_progress().
934 * @param[in] noti notification handle
935 * @param[in] percentage progress percentage
936 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
937 * @retval NOTIFICATION_ERROR_NONE - success
938 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
944 #include <notification.h>
947 notification_h noti = NULL;
948 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
950 noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
955 noti_err = notification_set_progress(noti, 0.0);
956 if(noti_err != NOTIFICATION_ERROR_NONE) {
957 notification_free(noti);
963 notification_error_e notification_set_progress(notification_h noti,
967 * @brief This function get progress percentage.
970 * @param[in] noti notification handle
971 * @param[out] percentage progress percentage
972 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
973 * @retval NOTIFICATION_ERROR_NONE - success
974 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
980 #include <notification.h>
983 notification_h noti = NULL;
984 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
985 double percentage = 0.0;
987 noti_err = notification_get_progress(noti, &percentage);
988 if(noti_err != NOTIFICATION_ERROR_NONE) {
994 notification_error_e notification_get_progress(notification_h noti,
998 * @brief This function set caller_pkgname.
999 * @details caller_pkgname is set automatically when notification_new. We are not recommend to use this API.
1001 * @param[in] noti notification handle
1002 * @param[in] pkgname caller package name
1003 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1004 * @retval NOTIFICATION_ERROR_NONE - success
1005 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
1011 #include <notification.h>
1014 notification_h noti = NULL;
1015 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1017 noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
1022 noti_err = notification_set_pkgname(noti, "org.tizen.phone");
1023 if(noti_err != NOTIFICATION_ERROR_NONE) {
1024 notification_free(noti);
1030 notification_error_e notification_set_pkgname(notification_h noti,
1031 const char *pkgname);
1034 * @brief This function get caller pkgname.
1037 * @param[in] noti notification handle
1038 * @param[out] pkgname caller package name
1039 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1040 * @retval NOTIFICATION_ERROR_NONE - success
1041 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
1047 #include <notification.h>
1050 notification_h noti = NULL;
1051 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1052 char *pkgname = NULL;
1054 noti_err = notification_get_pkgname(noti, &pkgname);
1055 if(noti_err != NOTIFICATION_ERROR_NONE) {
1061 notification_error_e notification_get_pkgname(notification_h noti,
1065 * @brief This function will be deprecated.
1066 * @see notification_set_badge()
1069 notification_error_e notification_set_unread_count(const char *pkgname,
1074 * @brief This function will be deprecated.
1075 * @see notification_get_badge()
1078 notification_error_e notification_get_unread_count(const char *pkgname,
1083 * @brief This function set application badge count.
1086 * @param[in] pkgname If NULL, caller pkgname is set internally.
1087 * @param[in] group_id group id
1088 * @param[in] count badge count
1089 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1090 * @retval NOTIFICATION_ERROR_NONE - success
1091 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
1096 #include <notification.h>
1099 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1101 noti_err = notification_set_badge(NULL, NOTIFICATION_GROUP_ID_NONE, 5);
1102 if(noti_err != NOTIFICATION_ERROR_NONE) {
1108 notification_error_e notification_set_badge(const char *pkgname,
1109 int group_id, int count);
1112 * @brief This function get application badge count.
1115 * @param[in] pkgname If NULL, caller pkgname is set internally.
1116 * @param[in] group_id group id
1117 * @param[out] count badge count
1118 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1119 * @retval NOTIFICATION_ERROR_NONE - success
1120 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
1125 #include <notification.h>
1128 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1131 noti_err = notification_get_badge(NULL, NOTIFICATION_GROUP_ID_NONE, &count);
1132 if(noti_err != NOTIFICATION_ERROR_NONE) {
1138 notification_error_e notification_get_badge(const char *pkgname,
1139 int group_id, int *count);
1142 * @brief This function get Group ID and Private ID
1145 * @param[in] noti notification handle
1146 * @param[out] group_id Group ID
1147 * @param[out] priv_id Private ID
1148 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1149 * @retval NOTIFICATION_ERROR_NONE - success
1150 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
1156 #include <notification.h>
1159 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1160 int group_id, priv_id;
1162 noti_err = notification_get_id(noti, &group_id, &priv_id);
1163 if(noti_err != NOTIFICATION_ERROR_NONE) {
1169 notification_error_e notification_get_id(notification_h noti,
1170 int *group_id, int *priv_id);
1173 * @brief This function get notification type
1176 * @param[in] noti notification handle
1177 * @param[out] type notification type
1178 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1179 * @retval NOTIFICATION_ERROR_NONE - success
1180 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
1186 #include <notification.h>
1189 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1190 notification_type_e type;
1192 noti_err = notification_get_type(noti, &type);
1193 if(noti_err != NOTIFICATION_ERROR_NONE) {
1199 notification_error_e notification_get_type(notification_h noti,
1200 notification_type_e * type);
1203 * @brief This function insert notification data.
1204 * @details Notification data is inserted to DB and then notification data is displaying display application.
1205 * When notification_new() call, if priv_id is NOTIFICATION_PRIV_ID_NONE, priv_id is return internally set priv_id.
1207 * @param[in] noti notification handle
1208 * @param[out] priv_id private ID
1209 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1210 * @retval NOTIFICATION_ERROR_NONE - success
1211 * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter
1212 * @pre notification_new()
1213 * @post notification_free()
1214 * @see #notification_h
1217 #include <notification.h>
1220 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1222 noti_err = notification_insert(noti, NULL);
1223 if(noti_err != NOTIFICATION_ERROR_NONE) {
1229 notification_error_e notification_insert(notification_h noti,
1233 * @brief This function update notification data. Not fully implemented yet.
1234 * @details Display application update UI.
1236 * @param[in] noti notification handle that is created by notification_new().
1237 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1238 * @retval NOTIFICATION_ERROR_NONE - success
1239 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
1242 * @see #notification_h
1245 #include <notification.h>
1248 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1250 noti_err = notification_update(NULL);
1251 if(noti_err != NOTIFICATION_ERROR_NONE) {
1257 notification_error_e notification_update(notification_h noti);
1260 * @brief This function clear all notification of type.
1261 * @details Not recommand API. Only for notification tray's clear button operation.
1263 * @param[in] type notification type
1264 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1265 * @retval NOTIFICATION_ERROR_NONE - success
1266 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
1269 * @see #notification_type_e
1272 #include <notification.h>
1275 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1277 noti_err = notifiation_clear(NOTIFICATION_TYPE_NOTI);
1278 if(noti_err != NOTIFICATION_ERROR_NONE) {
1284 notification_error_e notifiation_clear(notification_type_e type);
1287 * @brief This function delete notification by type.
1288 * @details If pkgname is NULL, caller_pkgname is set internally.
1290 * @param[in] pkgname caller application package name or NULL
1291 * @param[in] type notification type
1292 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1293 * @retval NOTIFICATION_ERROR_NONE - success
1294 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
1300 #include <notification.h>
1303 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1305 noti_err = notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_NOTI);
1306 if(noti_err != NOTIFICATION_ERROR_NONE) {
1312 notification_error_e notification_delete_all_by_type(const char *pkgname,
1313 notification_type_e type);
1316 * @brief This function delete group notification data by group ID.
1317 * @details If pkgname is NULL, caller_pkgname is set internally.
1319 * @param[in] pkgname caller application package name or NULL
1320 * @param[in] type notification type
1321 * @param[in] group_id group ID
1322 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1323 * @retval NOTIFICATION_ERROR_NONE - success
1324 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
1330 #include <notification.h>
1333 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1335 noti_err = notification_delete_group_by_group_id(NULL, NOTIFICATION_TYPE_NOTI, APP_GROUP_ID);
1336 if(noti_err != NOTIFICATION_ERROR_NONE) {
1342 notification_error_e notification_delete_group_by_group_id(const char *pkgname,
1343 notification_type_e type,
1347 * @brief This function delete group notification data that include priv_id.
1348 * @details If pkgname is NULL, caller_pkgname is set internally.
1350 * @param[in] pkgname caller application package name or NULL
1351 * @param[in] type notification type
1352 * @param[in] priv_id priv ID
1353 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1354 * @retval NOTIFICATION_ERROR_NONE - success
1355 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
1361 #include <notification.h>
1364 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1366 noti_err = notification_delete_group_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, APP_PRIV_ID);
1367 if(noti_err != NOTIFICATION_ERROR_NONE) {
1373 notification_error_e notification_delete_group_by_priv_id(const char *pkgname,
1374 notification_type_e type,
1378 * @brief This function delete notification data that private ID is priv_id.
1379 * @details If pkgname is NULL, caller_pkgname is set internally.
1381 * @param[in] pkgname caller application package name or NULL
1382 * @param[in] type notification type
1383 * @param[in] priv_id priv ID
1384 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1385 * @retval NOTIFICATION_ERROR_NONE - success
1386 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
1392 #include <notification.h>
1395 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1397 noti_err = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, APP_PRIV_ID);
1398 if(noti_err != NOTIFICATION_ERROR_NONE) {
1404 notification_error_e notification_delete_by_priv_id(const char *pkgname,
1405 notification_type_e type,
1409 * @brief This function delete notification data from DB
1410 * @details notification_delete() remove notification data from DB and notification_free release menory of notification data.
1412 * @param[in] noti notification handle
1413 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1414 * @retval NOTIFICATION_ERROR_NONE - success
1415 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
1418 * @see #notification_h
1421 #include <notification.h>
1424 notificaton_h noti = NULL;
1425 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1429 noti_err = notification_delete(noti);
1430 if(noti_err != NOTIFICATION_ERROR_NONE) {
1437 notification_error_e notification_delete(notification_h noti);
1440 * @brief This function update progressive data of inserted notification data. Only work at NOTIFICATION_TYPE_ONGOING type.
1441 * @details Display application update UI.
1443 * @param[in] noti notification handle or NULL if priv_id is valid
1444 * @param[in] priv_id private ID
1445 * @param[in] progress % value of progressive data
1446 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1447 * @retval NOTIFICATION_ERROR_NONE - success
1448 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
1453 #include <notification.h>
1456 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1458 noti_err = notification_update_progress(NULL, APP_NOTI_PRIV_ID, 0.6);
1459 if(noti_err != NOTIFICATION_ERROR_NONE) {
1465 notification_error_e notification_update_progress(notification_h noti,
1470 * @brief This function update progressive data of inserted notification data. Only work at NOTIFICATION_TYPE_ONGOING type.
1471 * @details Display application update UI.
1473 * @param[in] noti notification handle or NULL if priv_id is valid
1474 * @param[in] priv_id private ID
1475 * @param[in] size bytes of progressive data
1476 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1477 * @retval NOTIFICATION_ERROR_NONE - success
1478 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
1483 #include <notification.h>
1486 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1488 noti_err = notification_update_size(NULL, APP_NOTI_PRIV_ID, 3000000);
1489 if(noti_err != NOTIFICATION_ERROR_NONE) {
1495 notification_error_e notification_update_size(notification_h noti,
1496 int priv_id, double size);
1499 * @brief This function create internal structure data and return notification handle.
1500 * @details Available type is #NOTIFICATION_TYPE_NOTI and #NOTIFICATION_TYPE_ONGOING.
1501 * #NOTIFICATION_TYPE_NOTI is remaining notification data evenif device is restarted.
1502 * #NOTIFICATION_TYPE_ONGOING can display progressive feather, but notification data is removed after device is restarted.
1503 * If group_id is #NOTIFICATION_GROUP_ID_NONE, notification data is not grouping. #NOTIFICATION_GROUP_ID_DEFAULT,
1504 * notification data is grouping with same title. Positive number ( > 0 ) is grouping with same number.
1505 * If priv_id is #NOTIFICATION_PRIV_ID_NONE, priv_id is set internally and return it when notification_insert() call.
1506 * Positive number and zero ( >= 0 ) is application set private ID. These ID should have be unique each application package.
1508 * @param[in] type notification type
1509 * @param[in] group_id Group ID
1510 * @param[in] priv_id Priv ID
1511 * @return notification handle(#notification_h) if success, NULL if failure.
1512 * @retval #notification_h - success
1513 * @retval NULL - failure
1516 * @see #notification_type_e
1517 * @see #notification_h
1520 #include <notification.h>
1523 notification_h noti = NULL;
1525 noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
1533 notification_h notification_new(notification_type_e type, int group_id,
1537 * @brief This function free internal structure data of notification handle.
1538 * @details Internal data of notification handle is released. Notification data that inserted is not deleted.
1540 * @param[in] noti notification handle
1541 * @return NOTIFICATION_ERROR_NONE if success, other value if failure.
1542 * @retval NOTIFICATION_ERROR_NONE - success
1543 * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter
1544 * @pre notification_new()
1546 * @see #notification_h
1549 #include <notification.h>
1552 notification_h noti = NULL;
1553 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1555 noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
1561 noti_err = notification_free(noti);
1562 if(noti_err != NOTIFICATION_ERROR_NONE) {
1568 notification_error_e notification_free(notification_h noti);
1571 * @brief This function register notification chagned callback.
1574 * @param[in] changed_cb callback function
1575 * @param[in] user_data user data
1576 * @return NOTIFICATION_ERROR_NONE if success, other value if failure.
1577 * @retval NOTIFICATION_ERROR_NONE - success
1578 * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter
1579 * @pre notification_new()
1581 * @see notification_unresister_changed_cb()
1584 #include <notification.h>
1587 noti_err = notification_resister_changed_cb(app_changed_cb, user_data);
1588 if(noti_err != NOTIFICATION_ERROR_NONE) {
1594 notification_error_e
1595 notification_resister_changed_cb(
1596 void (*changed_cb)(void *data, notification_type_e type),
1600 * @brief This function unregister notification chagned callback.
1603 * @param[in] changed_cb callback function
1604 * @return NOTIFICATION_ERROR_NONE if success, other value if failure.
1605 * @retval NOTIFICATION_ERROR_NONE - success
1606 * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter
1607 * @pre notification_new()
1609 * @see notification_resister_changed_cb()
1612 #include <notification.h>
1615 noti_err = notification_unresister_changed_cb(app_changed_cb);
1616 if(noti_err != NOTIFICATION_ERROR_NONE) {
1622 notification_error_e
1623 notification_unresister_changed_cb(
1624 void (*changed_cb)(void *data, notification_type_e type));
1627 * @brief This function get notification data count.
1628 * @details Count is the result of the conditions that type, pkgname, group_id, priv_id.
1630 * @param[in] type notification type
1631 * @param[in] pkgname caller application package name
1632 * @param[in] group_id group id
1633 * @param[in] priv_id private id
1634 * @param[out] count notification data number
1635 * @return NOTIFICATION_ERROR_NONE if success, other value if failure.
1636 * @retval NOTIFICATION_ERROR_NONE - success
1637 * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter
1640 * @see #notification_type_e
1643 #include <notification.h>
1646 notification_list_h noti_list = NULL;
1647 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1650 noti_err = notification_get_count(NOTIFICATION_TYPE_NONE, NULL, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE, &count);
1651 if(noti_err != NOTIFICATION_ERROR_NONE) {
1657 notification_error_e notification_get_count(notification_type_e type,
1658 const char *pkgname,
1659 int group_id, int priv_id,
1663 * @brief This function will be deprecated.
1664 * @see notification_get_grouping_list()
1667 notification_error_e notification_get_list(notification_type_e type,
1669 notification_list_h * list);
1672 * @brief This function return notification grouping list handle.
1673 * @details If count is -1, all of notification list is returned.
1675 * @param[in] type notification type
1676 * @param[in] count returned notification data number
1677 * @param[out] list notification list handle
1678 * @return NOTIFICATION_ERROR_NONE if success, other value if failure.
1679 * @retval NOTIFICATION_ERROR_NONE - success
1680 * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter
1683 * @see #notification_list_h
1686 #include <notification.h>
1689 notification_list_h noti_list = NULL;
1690 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1692 noti_err = notification_get_grouping_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list);
1693 if(noti_err != NOTIFICATION_ERROR_NONE) {
1699 notification_error_e notification_get_grouping_list(notification_type_e type,
1701 notification_list_h *list);
1704 * @brief This function return notification detail list handle of grouping data.
1705 * @details If count is -1, all of notification list is returned.
1707 * @param[in] pkgname caller application package name
1708 * @param[in] group_id group id
1709 * @param[in] priv_id private id
1710 * @param[in] count returned notification data number
1711 * @param[out] list notification list handle
1712 * @return NOTIFICATION_ERROR_NONE if success, other value if failure.
1713 * @retval NOTIFICATION_ERROR_NONE - success
1714 * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter
1717 * @see #notification_list_h
1720 #include <notification.h>
1723 notification_list_h noti_list = NULL;
1724 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1726 noti_err = notification_get_detail_list(pkgname, group_id, priv_id, -1, ¬i_list);
1727 if(noti_err != NOTIFICATION_ERROR_NONE) {
1733 notification_error_e notification_get_detail_list(const char *pkgname,
1737 notification_list_h *list);
1740 * @brief This function release notification list.
1743 * @param[in] list notification list handle
1744 * @return NOTIFICATION_ERROR_NONE if success, other value if failure.
1745 * @retval NOTIFICATION_ERROR_NONE - success
1746 * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter
1747 * @pre notification_get_grouping_list() or notification_get_detail_list ()
1749 * @see #notification_list_h
1752 #include <notification.h>
1755 notification_list_h noti_list = NULL;
1756 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1760 noti_err = notification_free_list(noti_list);
1761 if(noti_err != NOTIFICATION_ERROR_NONE) {
1767 notification_error_e notification_free_list(notification_list_h list);
1776 #endif /* __NOTIFICATION_H__ */