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>, Youngsub Ko <ys4610.ko@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_content(notification_h noti,
261 const char *loc_content);
264 * @brief This function will be deprecated.
265 * @see notification_get_text()
268 notification_error_e notification_get_content(notification_h noti,
273 * @brief This function set text.
274 * @details Set title, content string. If text is formated data(only support %d, %f, %s), type - value pair should be set.
275 * If %d, type NOTIFICATION_VARIABLE_TYPE_INT and value is integer value.
276 * If %f, type NOTIFICATION_VARIABLE_TYPE_DOUBLE and value is double value.
277 * If %s, type NOTIFICATION_VARIABLE_TYPE_STRING and value is character string.
278 * If type is NOTIFICATION_VARIABLE_TYPE_COUNT, notification count is displaying with text.
279 * If value is NOTIFICATION_COUNT_POS_LEFT, count is displaying at the left of the text.
280 * If value is NOTIFICATION_COUNT_POS_IN, count is displaying in the text that text has %d format.
281 * If value is NOTIFICATION_COUNT_POS_RIGHT, count is displaying at the right of the text.
282 * Variable parameter should be terminated NOTIFICATION_VARIABLE_TYPE_NONE.
284 * @param[in] noti notification handle
285 * @param[in] type notification text type
286 * @param[in] text basic text
287 * @param[in] key text key for localization
288 * @param[in] args_type variable parameter that type - value pair.
289 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
290 * @retval NOTIFICATION_ERROR_NONE - success
291 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
292 * @pre notification handle should be created by notification_new().
297 #include <notification.h>
300 notification_h noti = NULL;
301 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
303 noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
308 noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, "I'm Title", "IDS_APP_BODY_IM_TITLE", NOTIFICATION_VARIABLE_TYPE_NONE);
309 if(noti_err != NOTIFICATION_ERROR_NONE) {
310 notification_free(noti);
316 notification_error_e notification_set_text(notification_h noti,
317 notification_text_type_e type,
323 * @brief This function get text.
326 * @param[in] noti notification handle
327 * @param[in] type notification text type.
328 * @param[out] text text
329 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
330 * @retval NOTIFICATION_ERROR_NONE - success
331 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
337 #include <notification.h>
340 notification_h noti = NULL;
341 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
344 noti_err = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, &text);
345 if(noti_err != NOTIFICATION_ERROR_NONE) {
351 notification_error_e notification_get_text(notification_h noti,
352 notification_text_type_e type,
356 * @brief This function set text domain.
359 * @param[in] noti notification handle
360 * @param[in] domain text domain
361 * @param[in] dir text dir
362 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
363 * @retval NOTIFICATION_ERROR_NONE - success
364 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
370 #include <notification.h>
373 notification_h noti = NULL;
374 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
376 noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
381 noti_err = notification_set_text_domain(noti, PACKAGE, LOCALEDIR);
382 if(noti_err != NOTIFICATION_ERROR_NONE) {
383 notification_free(noti);
389 notification_error_e notification_set_text_domain(notification_h noti,
394 * @brief This function get text domain.
396 * @remarks Do not free returned domain and dir. These are freed when notification_free or notification_free_list.
397 * @param[in] noti notification handle
398 * @param[out] domain domain
399 * @param[out] dir locale dir
400 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
401 * @retval NOTIFICATION_ERROR_NONE - success
402 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
408 #include <notification.h>
411 notification_h noti = NULL;
412 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
416 noti_err = notification_get_text_domain(noti, &domain, &dir);
417 if(noti_err != NOTIFICATION_ERROR_NONE) {
423 notification_error_e notification_get_text_domain(notification_h noti,
428 * @brief This function set notification sound.
431 * @param[in] noti notification handle
432 * @param[in] type notification sound type
433 * @param[in] path user sound file path
434 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
435 * @retval NOTIFICATION_ERROR_NONE - success
436 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
442 #include <notification.h>
445 notification_h noti = NULL;
446 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
448 noti_err = notification_set_sound(noti, NOTIFICATION_SOUND_TYPE_DEFAULT, NULL);
449 if(noti_err != NOTIFICATION_ERROR_NONE) {
455 notification_error_e notification_set_sound(notification_h noti,
456 notification_sound_type_e type,
460 * @brief This function get notification sound.
463 * @param[in] noti notification handle
464 * @param[out] type notification sound type
465 * @param[out] path user sound file path
466 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
467 * @retval NOTIFICATION_ERROR_NONE - success
468 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
474 #include <notification.h>
477 notification_h noti = NULL;
478 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
479 notification_sound_type_e type = NOTIFICATION_SOUND_TYPE_NONE;
481 noti_err = notification_get_sound(noti, &type, NULL);
482 if(noti_err != NOTIFICATION_ERROR_NONE) {
488 notification_error_e notification_get_sound(notification_h noti,
489 notification_sound_type_e *type,
493 * @brief This function set notification vibration.
496 * @param[in] noti notification handle
497 * @param[in] type notification vibration type
498 * @param[in] path user vibration file path
499 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
500 * @retval NOTIFICATION_ERROR_NONE - success
501 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
507 #include <notification.h>
510 notification_h noti = NULL;
511 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
513 noti_err = notification_set_vibration(noti, NOTIFICATION_VIBRATION_TYPE_DEFAULT, NULL);
514 if(noti_err != NOTIFICATION_ERROR_NONE) {
520 notification_error_e notification_set_vibration(notification_h noti,
521 notification_vibration_type_e type,
525 * @brief This function get notification vibration.
528 * @param[in] noti notification handle
529 * @param[out] type notification sound type
530 * @param[out] path user vibration file path
531 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
532 * @retval NOTIFICATION_ERROR_NONE - success
533 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
539 #include <notification.h>
542 notification_h noti = NULL;
543 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
544 notification_vibration_type_e type = NOTIFICATION_VIBRATION_TYPE_NONE;
546 noti_err = notification_get_vibration(noti, &type, NULL);
547 if(noti_err != NOTIFICATION_ERROR_NONE) {
553 notification_error_e notification_get_vibration(notification_h noti,
554 notification_vibration_type_e *type,
558 * @brief This function will be deprecated.
559 * @see notification_set_execute_option()
562 notification_error_e notification_set_application(notification_h noti, const char *pkgname); /* Do not use this */
565 * @brief This function will be deprecated.
566 * @see notification_get_execute_option()
569 notification_error_e notification_get_application(notification_h noti, char **pkgname); /* Do not use this */
572 * @brief This function will be deprecated.
573 * @see notification_set_execute_option()
576 notification_error_e notification_set_args(notification_h noti, bundle * args, bundle * group_args); /* Do not use this */
579 * @brief This function will be deprecated.
580 * @see notification_get_execute_option()
583 notification_error_e notification_get_args(notification_h noti, bundle ** args, bundle ** group_args); /* Do not use this */
586 * @brief This function set execute option.
587 * @details When notification data selected in display application, application launched by appsvc_run_service with service_handle.
589 * @param[in] noti notification handle
590 * @param[in] type notification execute type
591 * @param[in] text basic text for button
592 * @param[in] key value for localizaed text
593 * @param[in] service_handle appsvc bundle data
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;
612 appsvc_set_operation(b, APPSVC_OPERATION_VIEW);
613 appsvc_set_uri(b,"http://www.samsung.com");
615 noti_err = notification_set_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, b);
616 if(noti_err != NOTIFICATION_ERROR_NONE) {
617 notification_free(noti);
625 notification_error_e notification_set_execute_option(notification_h noti,
626 notification_execute_type_e type,
629 bundle *service_handle);
632 * @brief This function get execute option.
635 * @param[in] noti notification handle
636 * @param[in] type notification execute type
637 * @param[out] text text for button
638 * @param[out] service_handle appsvc bundle data
639 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
640 * @retval NOTIFICATION_ERROR_NONE - success
641 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
647 #include <notification.h>
650 notification_h noti = NULL;
651 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
656 noti_err = notification_get_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, &b);
657 if(noti_err != NOTIFICATION_ERROR_NONE) {
658 notification_free(noti);
664 notification_error_e notification_get_execute_option(notification_h noti,
665 notification_execute_type_e type,
667 bundle **service_handle);
670 * @brief This function set notification property.
673 * @param[in] noti notification handle
674 * @param[in] flags property with | operation
675 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
676 * @retval NOTIFICATION_ERROR_NONE - success
677 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
683 #include <notification.h>
686 notification_h noti = NULL;
687 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
690 noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
695 noti_err = notification_set_property(noti, NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE | NOTIFICATION_PROP_DISABLE_APP_LAUNCH);
696 if(noti_err != NOTIFICATION_ERROR_NONE) {
697 notification_free(noti);
703 notification_error_e notification_set_property(notification_h noti,
707 * @brief This function get notification property.
710 * @param[in] noti notification handle
711 * @param[out] flags notification property
712 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
713 * @retval NOTIFICATION_ERROR_NONE - success
714 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
720 #include <notification.h>
723 notification_h noti = NULL;
724 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
727 noti_err = notification_get_property(noti, &flags);
728 if(noti_err != NOTIFICATION_ERROR_NONE) {
734 notification_error_e notification_get_property(notification_h noti,
738 * @brief This function set display application list.
739 * @details All display application is enable(NOTIFICATION_DISPLAY_APP_ALL) if you are not call this API.
741 * @param[in] noti notification handle
742 * @param[in] applist with | operation
743 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
744 * @retval NOTIFICATION_ERROR_NONE - success
745 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
751 #include <notification.h>
754 notification_h noti = NULL;
755 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
758 noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
763 noti_err = notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_TICKER);
764 if(noti_err != NOTIFICATION_ERROR_NONE) {
765 notification_free(noti);
772 notification_error_e notification_set_display_applist(notification_h noti,
776 * @brief This function get display application list.
779 * @param[in] noti notification handle
780 * @param[out] applist display application list.
781 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
782 * @retval NOTIFICATION_ERROR_NONE - success
783 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
789 #include <notification.h>
792 notification_h noti = NULL;
793 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
796 noti_err = notification_get_display_applist(noti, &applist);
797 if(noti_err != NOTIFICATION_ERROR_NONE) {
803 notification_error_e notification_get_display_applist(notification_h noti,
807 * @brief This function set initial size for ongoing type.
808 * @details After notification_insert, it does not upate size. If you want to update size, please call notification_update_size().
810 * @param[in] noti notification handle
811 * @param[in] size double type size.
812 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
813 * @retval NOTIFICATION_ERROR_NONE - success
814 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
820 #include <notification.h>
823 notification_h noti = NULL;
824 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
826 noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
831 noti_err = notification_set_size(noti, 0.0);
832 if(noti_err != NOTIFICATION_ERROR_NONE) {
833 notification_free(noti);
839 notification_error_e notification_set_size(notification_h noti,
843 * @brief This function get progress size.
846 * @param[in] noti notification handle
847 * @param[out] size progress size
848 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
849 * @retval NOTIFICATION_ERROR_NONE - success
850 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
856 #include <notification.h>
859 notification_h noti = NULL;
860 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
863 noti_err = notification_get_size(noti, &size);
864 if(noti_err != NOTIFICATION_ERROR_NONE) {
870 notification_error_e notification_get_size(notification_h noti,
874 * @brief This function set initial progress for ongoing type.
875 * @details After notification_insert, it does not upate progress. If you want to update progress, please call notification_update_progress().
877 * @param[in] noti notification handle
878 * @param[in] percentage progress percentage
879 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
880 * @retval NOTIFICATION_ERROR_NONE - success
881 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
887 #include <notification.h>
890 notification_h noti = NULL;
891 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
893 noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
898 noti_err = notification_set_progress(noti, 0.0);
899 if(noti_err != NOTIFICATION_ERROR_NONE) {
900 notification_free(noti);
906 notification_error_e notification_set_progress(notification_h noti,
910 * @brief This function get progress percentage.
913 * @param[in] noti notification handle
914 * @param[out] percentage progress percentage
915 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
916 * @retval NOTIFICATION_ERROR_NONE - success
917 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
923 #include <notification.h>
926 notification_h noti = NULL;
927 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
928 double percentage = 0.0;
930 noti_err = notification_get_progress(noti, &percentage);
931 if(noti_err != NOTIFICATION_ERROR_NONE) {
937 notification_error_e notification_get_progress(notification_h noti,
941 * @brief This function set caller_pkgname.
942 * @details caller_pkgname is set automatically when notification_new. We are not recommend to use this API.
944 * @param[in] noti notification handle
945 * @param[in] pkgname caller package name
946 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
947 * @retval NOTIFICATION_ERROR_NONE - success
948 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
954 #include <notification.h>
957 notification_h noti = NULL;
958 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
960 noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
965 noti_err = notification_set_pkgname(noti, "org.tizen.phone");
966 if(noti_err != NOTIFICATION_ERROR_NONE) {
967 notification_free(noti);
973 notification_error_e notification_set_pkgname(notification_h noti,
974 const char *pkgname);
977 * @brief This function get caller pkgname.
980 * @param[in] noti notification handle
981 * @param[out] pkgname caller package name
982 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
983 * @retval NOTIFICATION_ERROR_NONE - success
984 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
990 #include <notification.h>
993 notification_h noti = NULL;
994 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
995 char *pkgname = NULL;
997 noti_err = notification_get_pkgname(noti, &pkgname);
998 if(noti_err != NOTIFICATION_ERROR_NONE) {
1004 notification_error_e notification_get_pkgname(notification_h noti,
1008 * @brief This function set application badge count.
1011 * @param[in] pkgname If NULL, caller pkgname is set internally.
1012 * @param[in] group_id group id
1013 * @param[in] count badge count
1014 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1015 * @retval NOTIFICATION_ERROR_NONE - success
1016 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
1021 #include <notification.h>
1024 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1026 noti_err = notification_set_badge(NULL, NOTIFICATION_GROUP_ID_NONE, 5);
1027 if(noti_err != NOTIFICATION_ERROR_NONE) {
1033 notification_error_e notification_set_badge(const char *pkgname,
1034 int group_id, int count);
1037 * @brief This function get application badge count.
1040 * @param[in] pkgname If NULL, caller pkgname is set internally.
1041 * @param[in] group_id group id
1042 * @param[out] count badge count
1043 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1044 * @retval NOTIFICATION_ERROR_NONE - success
1045 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
1050 #include <notification.h>
1053 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1056 noti_err = notification_get_badge(NULL, NOTIFICATION_GROUP_ID_NONE, &count);
1057 if(noti_err != NOTIFICATION_ERROR_NONE) {
1063 notification_error_e notification_get_badge(const char *pkgname,
1064 int group_id, int *count);
1067 * @brief This function get Group ID and Private ID
1070 * @param[in] noti notification handle
1071 * @param[out] group_id Group ID
1072 * @param[out] priv_id Private ID
1073 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1074 * @retval NOTIFICATION_ERROR_NONE - success
1075 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
1081 #include <notification.h>
1084 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1085 int group_id, priv_id;
1087 noti_err = notification_get_id(noti, &group_id, &priv_id);
1088 if(noti_err != NOTIFICATION_ERROR_NONE) {
1094 notification_error_e notification_get_id(notification_h noti,
1095 int *group_id, int *priv_id);
1098 * @brief This function get notification type
1101 * @param[in] noti notification handle
1102 * @param[out] type notification type
1103 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1104 * @retval NOTIFICATION_ERROR_NONE - success
1105 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
1111 #include <notification.h>
1114 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1115 notification_type_e type;
1117 noti_err = notification_get_type(noti, &type);
1118 if(noti_err != NOTIFICATION_ERROR_NONE) {
1124 notification_error_e notification_get_type(notification_h noti,
1125 notification_type_e * type);
1128 * @brief This function insert notification data.
1129 * @details Notification data is inserted to DB and then notification data is displaying display application.
1130 * When notification_new() call, if priv_id is NOTIFICATION_PRIV_ID_NONE, priv_id is return internally set priv_id.
1132 * @param[in] noti notification handle
1133 * @param[out] priv_id private ID
1134 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1135 * @retval NOTIFICATION_ERROR_NONE - success
1136 * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter
1137 * @pre notification_new()
1138 * @post notification_free()
1139 * @see #notification_h
1142 #include <notification.h>
1145 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1147 noti_err = notification_insert(noti, NULL);
1148 if(noti_err != NOTIFICATION_ERROR_NONE) {
1154 notification_error_e notification_insert(notification_h noti,
1158 * @brief This function update notification data.
1159 * @details Display application update UI.
1161 * @param[in] noti notification handle that is created by notification_new().
1162 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1163 * @retval NOTIFICATION_ERROR_NONE - success
1164 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
1165 * @retval NOTIFICATION_ERROR_NOT_EXIST_ID - not exist priv id
1168 * @see #notification_h
1171 #include <notification.h>
1174 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1176 noti_err = notification_update(NULL);
1177 if(noti_err != NOTIFICATION_ERROR_NONE) {
1183 notification_error_e notification_update(notification_h noti);
1186 * @brief This function clear all notification of type.
1187 * @details Not recommand API. Only for notification tray's clear button operation.
1189 * @param[in] type notification type
1190 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1191 * @retval NOTIFICATION_ERROR_NONE - success
1192 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
1195 * @see #notification_type_e
1198 #include <notification.h>
1201 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1203 noti_err = notifiation_clear(NOTIFICATION_TYPE_NOTI);
1204 if(noti_err != NOTIFICATION_ERROR_NONE) {
1210 notification_error_e notifiation_clear(notification_type_e type);
1213 * @brief This function delete notification by type.
1214 * @details If pkgname is NULL, caller_pkgname is set internally.
1216 * @param[in] pkgname caller application package name or NULL
1217 * @param[in] type notification type
1218 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1219 * @retval NOTIFICATION_ERROR_NONE - success
1220 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
1226 #include <notification.h>
1229 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1231 noti_err = notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_NOTI);
1232 if(noti_err != NOTIFICATION_ERROR_NONE) {
1238 notification_error_e notification_delete_all_by_type(const char *pkgname,
1239 notification_type_e type);
1242 * @brief This function delete group notification data by group ID.
1243 * @details If pkgname is NULL, caller_pkgname is set internally.
1245 * @param[in] pkgname caller application package name or NULL
1246 * @param[in] type notification type
1247 * @param[in] group_id group ID
1248 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1249 * @retval NOTIFICATION_ERROR_NONE - success
1250 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
1256 #include <notification.h>
1259 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1261 noti_err = notification_delete_group_by_group_id(NULL, NOTIFICATION_TYPE_NOTI, APP_GROUP_ID);
1262 if(noti_err != NOTIFICATION_ERROR_NONE) {
1268 notification_error_e notification_delete_group_by_group_id(const char *pkgname,
1269 notification_type_e type,
1273 * @brief This function delete group notification data that include priv_id.
1274 * @details If pkgname is NULL, caller_pkgname is set internally.
1276 * @param[in] pkgname caller application package name or NULL
1277 * @param[in] type notification type
1278 * @param[in] priv_id priv ID
1279 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1280 * @retval NOTIFICATION_ERROR_NONE - success
1281 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
1287 #include <notification.h>
1290 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1292 noti_err = notification_delete_group_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, APP_PRIV_ID);
1293 if(noti_err != NOTIFICATION_ERROR_NONE) {
1299 notification_error_e notification_delete_group_by_priv_id(const char *pkgname,
1300 notification_type_e type,
1304 * @brief This function delete notification data that private ID is priv_id.
1305 * @details If pkgname is NULL, caller_pkgname is set internally.
1307 * @param[in] pkgname caller application package name or NULL
1308 * @param[in] type notification type
1309 * @param[in] priv_id priv ID
1310 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1311 * @retval NOTIFICATION_ERROR_NONE - success
1312 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
1318 #include <notification.h>
1321 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1323 noti_err = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, APP_PRIV_ID);
1324 if(noti_err != NOTIFICATION_ERROR_NONE) {
1330 notification_error_e notification_delete_by_priv_id(const char *pkgname,
1331 notification_type_e type,
1335 * @brief This function delete notification data from DB
1336 * @details notification_delete() remove notification data from DB and notification_free release menory of notification data.
1338 * @param[in] noti notification handle
1339 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1340 * @retval NOTIFICATION_ERROR_NONE - success
1341 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
1344 * @see #notification_h
1347 #include <notification.h>
1350 notificaton_h noti = NULL;
1351 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1355 noti_err = notification_delete(noti);
1356 if(noti_err != NOTIFICATION_ERROR_NONE) {
1363 notification_error_e notification_delete(notification_h noti);
1366 * @brief This function update progressive data of inserted notification data. Only work at NOTIFICATION_TYPE_ONGOING type.
1367 * @details Display application update UI.
1369 * @param[in] noti notification handle or NULL if priv_id is valid
1370 * @param[in] priv_id private ID
1371 * @param[in] progress % value of progressive data
1372 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1373 * @retval NOTIFICATION_ERROR_NONE - success
1374 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
1379 #include <notification.h>
1382 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1384 noti_err = notification_update_progress(NULL, APP_NOTI_PRIV_ID, 0.6);
1385 if(noti_err != NOTIFICATION_ERROR_NONE) {
1391 notification_error_e notification_update_progress(notification_h noti,
1396 * @brief This function update progressive data of inserted notification data. Only work at NOTIFICATION_TYPE_ONGOING type.
1397 * @details Display application update UI.
1399 * @param[in] noti notification handle or NULL if priv_id is valid
1400 * @param[in] priv_id private ID
1401 * @param[in] size bytes of progressive data
1402 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
1403 * @retval NOTIFICATION_ERROR_NONE - success
1404 * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
1409 #include <notification.h>
1412 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1414 noti_err = notification_update_size(NULL, APP_NOTI_PRIV_ID, 3000000);
1415 if(noti_err != NOTIFICATION_ERROR_NONE) {
1421 notification_error_e notification_update_size(notification_h noti,
1422 int priv_id, double size);
1424 notification_error_e notification_update_content(notification_h noti,
1426 const char *content);
1429 * @brief This function create internal structure data and return notification handle.
1430 * @details Available type is #NOTIFICATION_TYPE_NOTI and #NOTIFICATION_TYPE_ONGOING.
1431 * #NOTIFICATION_TYPE_NOTI is remaining notification data evenif device is restarted.
1432 * #NOTIFICATION_TYPE_ONGOING can display progressive feather, but notification data is removed after device is restarted.
1433 * If group_id is #NOTIFICATION_GROUP_ID_NONE, notification data is not grouping. #NOTIFICATION_GROUP_ID_DEFAULT,
1434 * notification data is grouping with same title. Positive number ( > 0 ) is grouping with same number.
1435 * If priv_id is #NOTIFICATION_PRIV_ID_NONE, priv_id is set internally and return it when notification_insert() call.
1436 * Positive number and zero ( >= 0 ) is application set private ID. These ID should have be unique each application package.
1438 * @param[in] type notification type
1439 * @param[in] group_id Group ID
1440 * @param[in] priv_id Priv ID
1441 * @return notification handle(#notification_h) if success, NULL if failure.
1442 * @retval #notification_h - success
1443 * @retval NULL - failure
1446 * @see #notification_type_e
1447 * @see #notification_h
1450 #include <notification.h>
1453 notification_h noti = NULL;
1455 noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
1463 notification_h notification_new(notification_type_e type, int group_id,
1467 * @brief This function create notification clone.
1468 * @details Newly created notification handle is returned.
1469 * @remarks This clone notification handle should be call notification_free().
1470 * @param[in] noti notification handle
1471 * @param[out] clone newly created notification handle that has same with input noti.
1472 * @return NOTIFICATION_ERROR_NONE if success, other value if failure.
1473 * @retval NOTIFICATION_ERROR_NONE - success
1474 * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter
1477 * @see #notification_type_e
1478 * @see #notification_h
1481 #include <notification.h>
1484 notification_h noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
1485 notification_h clone = NULL;
1487 notification_clone(noti, &clone);
1492 notification_error_e notification_clone(notification_h noti, notification_h *clone);
1495 * @brief This function free internal structure data of notification handle.
1496 * @details Internal data of notification handle is released. Notification data that inserted is not deleted.
1498 * @param[in] noti notification handle
1499 * @return NOTIFICATION_ERROR_NONE if success, other value if failure.
1500 * @retval NOTIFICATION_ERROR_NONE - success
1501 * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter
1502 * @pre notification_new()
1504 * @see #notification_h
1507 #include <notification.h>
1510 notification_h noti = NULL;
1511 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1513 noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
1519 noti_err = notification_free(noti);
1520 if(noti_err != NOTIFICATION_ERROR_NONE) {
1526 notification_error_e notification_free(notification_h noti);
1529 * @brief This function register notification chagned callback.
1532 * @param[in] changed_cb callback function
1533 * @param[in] user_data user data
1534 * @return NOTIFICATION_ERROR_NONE if success, other value if failure.
1535 * @retval NOTIFICATION_ERROR_NONE - success
1536 * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter
1537 * @pre notification_new()
1539 * @see notification_unresister_changed_cb()
1542 #include <notification.h>
1545 noti_err = notification_resister_changed_cb(app_changed_cb, user_data);
1546 if(noti_err != NOTIFICATION_ERROR_NONE) {
1552 notification_error_e
1553 notification_resister_changed_cb(
1554 void (*changed_cb)(void *data, notification_type_e type),
1558 * @brief This function unregister notification chagned callback.
1561 * @param[in] changed_cb callback function
1562 * @return NOTIFICATION_ERROR_NONE if success, other value if failure.
1563 * @retval NOTIFICATION_ERROR_NONE - success
1564 * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter
1565 * @pre notification_new()
1567 * @see notification_resister_changed_cb()
1570 #include <notification.h>
1573 noti_err = notification_unresister_changed_cb(app_changed_cb);
1574 if(noti_err != NOTIFICATION_ERROR_NONE) {
1580 notification_error_e
1581 notification_unresister_changed_cb(
1582 void (*changed_cb)(void *data, notification_type_e type));
1585 * @brief This function get notification data count.
1586 * @details Count is the result of the conditions that type, pkgname, group_id, priv_id.
1588 * @param[in] type notification type
1589 * @param[in] pkgname caller application package name
1590 * @param[in] group_id group id
1591 * @param[in] priv_id private id
1592 * @param[out] count notification data number
1593 * @return NOTIFICATION_ERROR_NONE if success, other value if failure.
1594 * @retval NOTIFICATION_ERROR_NONE - success
1595 * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter
1598 * @see #notification_type_e
1601 #include <notification.h>
1604 notification_list_h noti_list = NULL;
1605 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1608 noti_err = notification_get_count(NOTIFICATION_TYPE_NONE, NULL, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE, &count);
1609 if(noti_err != NOTIFICATION_ERROR_NONE) {
1615 notification_error_e notification_get_count(notification_type_e type,
1616 const char *pkgname,
1617 int group_id, int priv_id,
1621 * @brief This function will be deprecated.
1622 * @see notification_get_grouping_list()
1625 notification_error_e notification_get_list(notification_type_e type,
1627 notification_list_h * list);
1630 * @brief This function return notification grouping list handle.
1631 * @details If count is -1, all of notification list is returned.
1633 * @param[in] type notification type
1634 * @param[in] count returned notification data number
1635 * @param[out] list notification list handle
1636 * @return NOTIFICATION_ERROR_NONE if success, other value if failure.
1637 * @retval NOTIFICATION_ERROR_NONE - success
1638 * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter
1641 * @see #notification_list_h
1644 #include <notification.h>
1647 notification_list_h noti_list = NULL;
1648 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1650 noti_err = notification_get_grouping_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list);
1651 if(noti_err != NOTIFICATION_ERROR_NONE) {
1657 notification_error_e notification_get_grouping_list(notification_type_e type,
1659 notification_list_h *list);
1662 * @brief This function return notification detail list handle of grouping data.
1663 * @details If count is -1, all of notification list is returned.
1665 * @param[in] pkgname caller application package name
1666 * @param[in] group_id group id
1667 * @param[in] priv_id private id
1668 * @param[in] count returned notification data number
1669 * @param[out] list notification list handle
1670 * @return NOTIFICATION_ERROR_NONE if success, other value if failure.
1671 * @retval NOTIFICATION_ERROR_NONE - success
1672 * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter
1675 * @see #notification_list_h
1678 #include <notification.h>
1681 notification_list_h noti_list = NULL;
1682 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1684 noti_err = notification_get_detail_list(pkgname, group_id, priv_id, -1, ¬i_list);
1685 if(noti_err != NOTIFICATION_ERROR_NONE) {
1691 notification_error_e notification_get_detail_list(const char *pkgname,
1695 notification_list_h *list);
1698 * @brief This function release notification list.
1701 * @param[in] list notification list handle
1702 * @return NOTIFICATION_ERROR_NONE if success, other value if failure.
1703 * @retval NOTIFICATION_ERROR_NONE - success
1704 * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter
1705 * @pre notification_get_grouping_list() or notification_get_detail_list ()
1707 * @see #notification_list_h
1710 #include <notification.h>
1713 notification_list_h noti_list = NULL;
1714 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1718 noti_err = notification_free_list(noti_list);
1719 if(noti_err != NOTIFICATION_ERROR_NONE) {
1725 notification_error_e notification_free_list(notification_list_h list);
1734 #endif /* __NOTIFICATION_H__ */