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__
29 #include <notification_error.h>
30 #include <notification_type.h>
31 #include <notification_list.h>
32 #include <notification_status.h>
39 * @file notification.h
40 * @brief This file contains the notification API.
44 * @addtogroup NOTIFICATION_MODULE
49 * @brief Sets an absolute path for an image file to display on the notification view.
52 * @feature http://tizen.org/feature/notification
53 * @param[in] noti The notification handle
54 * @param[in] type The notification image type
55 * @param[in] image_path The image file full path
56 * @return #NOTIFICATION_ERROR_NONE on success,
57 * otherwise any other value on failure
58 * @retval #NOTIFICATION_ERROR_NONE Success
59 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
60 * @pre Notification handle should be created by notification_create().
61 * @see #notification_image_type_e
62 * @see notification_create()
65 #include <notification.h>
68 notification_h noti = NULL;
69 int noti_err = NOTIFICATION_ERROR_NONE;
71 noti = notification_create(NOTIFICATION_TYPE_NOTI);
76 noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, APP_IMAGE_FULL_PATH);
77 if(noti_err != NOTIFICATION_ERROR_NONE) {
78 notification_free(noti);
84 int notification_set_image(notification_h noti,
85 notification_image_type_e type,
86 const char *image_path);
89 * @brief Gets the absolute path of an image file.
91 * @remarks Do not free @a image_path. It will be freed when notification_free() is called.
92 * @param[in] noti Notification handle
93 * @param[in] type Notification image type
94 * @param[out] image_path image file full path
95 * @return NOTIFICATION_ERROR_NONE on success, other value on failure
96 * @retval NOTIFICATION_ERROR_NONE Success
97 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
98 * @pre Notification handle should be created by notification_create().
99 * @see #notification_image_type_e
100 * @see notification_create()
103 #include <notification.h>
106 char *image_path = NULL;
107 int noti_err = NOTIFICATION_ERROR_NONE;
109 noti_err = notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, &image_path);
110 if(noti_err != NOTIFICATION_ERROR_NONE) {
116 int notification_get_image(notification_h noti,
117 notification_image_type_e type,
121 * @brief Sets a timestamp.
122 * @details If input_time is @c 0, time information is taken from the current time.
124 * @param[in] noti The notification handle
125 * @param[in] input_time The input time
126 * @return #NOTIFICATION_ERROR_NONE on success,
127 * otherwise any other value on failure
128 * @retval #NOTIFICATION_ERROR_NONE Success
129 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
130 * @pre Notification handle should be created by notification_create().
131 * @see notification_create()
134 #include <notification.h>
137 notification_h noti = NULL;
138 int noti_err = NOTIFICATION_ERROR_NONE;
140 noti = notification_create(NOTIFICATION_TYPE_NOTI);
145 noti_err = notification_set_time(noti, time(NULL));
146 if(noti_err != NOTIFICATION_ERROR_NONE) {
147 notification_free(noti);
153 int notification_set_time(notification_h noti,
157 * @brief Gets a timestamp.
158 * @details If ret_time is @c 0, time information is not set before.
160 * @param[in] noti The notification handle
161 * @param[out] ret_time The return time value
162 * @return #NOTIFICATION_ERROR_NONE on success,
163 * otherwise any other value on failure
164 * @retval #NOTIFICATION_ERROR_NONE Success
165 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
166 * @pre Notification handle should be created by notification_create().
167 * @see notification_create()
170 #include <notification.h>
174 int noti_err = NOTIFICATION_ERROR_NONE;
176 noti_err = notification_get_time(noti, &ret_time);
177 if(noti_err != NOTIFICATION_ERROR_NONE) {
183 int notification_get_time(notification_h noti,
187 * @brief Gets an insertion timestamp of the notification.
188 * @details If ret_time is @c 0, this notification data is not inserted before.
190 * @param[in] noti The notification handle
191 * @param[out] ret_time The return time value
192 * @return #NOTIFICATION_ERROR_NONE on success,
193 * otherwise any other value on failure
194 * @retval #NOTIFICATION_ERROR_NONE Success
195 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
198 #include <notification.h>
202 int noti_err = NOTIFICATION_ERROR_NONE;
204 noti_err = notification_get_insert_time(noti, &ret_time);
205 if(noti_err != NOTIFICATION_ERROR_NONE) {
211 int notification_get_insert_time(notification_h noti,
215 * @brief Sets the text to display on the notification view.
216 * @details Sets title, content string. If the text is formatted data (only %d, %f, %s are supported), type - value pair should be set.
217 * If %d, the type #NOTIFICATION_VARIABLE_TYPE_INT and the value is an integer.
218 * If %f, the type #NOTIFICATION_VARIABLE_TYPE_DOUBLE and the value is a double.
219 * If %s, the type #NOTIFICATION_VARIABLE_TYPE_STRING and the value is a string.
220 * If the type is #NOTIFICATION_VARIABLE_TYPE_COUNT, notification count is displaying with text.
221 * If the value is #NOTIFICATION_COUNT_POS_LEFT, count is displayed at the left of the text.
222 * If the value is #NOTIFICATION_COUNT_POS_IN, count is displayed in the text when text has %d format.
223 * If the value is #NOTIFICATION_COUNT_POS_RIGHT, count is displayed at the right of the text.
224 * Variable parameters should be terminated #NOTIFICATION_VARIABLE_TYPE_NONE.
226 * @param[in] noti The notification handle
227 * @param[in] type The notification text type
228 * @param[in] text The basic text
229 * @param[in] key The text key for localization
230 * @param[in] args_type The variable parameter that type - value pair
231 * @return #NOTIFICATION_ERROR_NONE on success,
232 * otherwise any other value on failure
233 * @retval #NOTIFICATION_ERROR_NONE Success
234 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
235 * @pre notification handle should be created by notification_create().
238 #include <notification.h>
241 notification_h noti = NULL;
242 int noti_err = NOTIFICATION_ERROR_NONE;
244 noti = notification_create(NOTIFICATION_TYPE_NOTI);
249 noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, "I'm Title", "IDS_APP_BODY_IM_TITLE", NOTIFICATION_VARIABLE_TYPE_NONE);
250 if(noti_err != NOTIFICATION_ERROR_NONE) {
251 notification_free(noti);
257 int notification_set_text(notification_h noti,
258 notification_text_type_e type,
264 * @brief Gets the text from the notification handle.
266 * @param[in] noti The notification handle
267 * @param[in] type The notification text type
268 * @param[out] text The notification text
269 * @return #NOTIFICATION_ERROR_NONE on success,
270 * otherwise any other value on failure
271 * @retval #NOTIFICATION_ERROR_NONE Success
272 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
275 #include <notification.h>
278 notification_h noti = NULL;
279 int noti_err = NOTIFICATION_ERROR_NONE;
282 noti_err = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, &text);
283 if(noti_err != NOTIFICATION_ERROR_NONE) {
289 int notification_get_text(notification_h noti,
290 notification_text_type_e type,
294 * @brief Sets the timestamp to display on the notification view.
295 * @details The timestamp will be converted to a formatted string and it will be displayed on the set text area.
297 * @param[in] noti The notification handle
298 * @param[in] type The notification text type
299 * @param[in] time The timestamp
300 * @return #NOTIFICATION_ERROR_NONE on success,
301 * otherwise any other value on failure
302 * @retval #NOTIFICATION_ERROR_NONE Success
303 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
304 * @pre Notification handle should be created by notification_create().
306 int notification_set_time_to_text(notification_h noti, notification_text_type_e type,
310 * @brief Gets the timestamp from the notification handle.
312 * @param[in] noti The notification handle
313 * @param[in] type The notification text type
314 * @param[in] time The pointer of time stamp
315 * @return #NOTIFICATION_ERROR_NONE on success,
316 * otherwise any other value on failure
317 * @retval #NOTIFICATION_ERROR_NONE Success
318 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
319 * @pre Notification handle should be created by notification_create().
321 int notification_get_time_from_text(notification_h noti, notification_text_type_e type,
326 * @brief Sets the text domain to localize the notification.
328 * @param[in] noti The notification handle
329 * @param[in] domain The text domain
330 * @param[in] dir The text dir
331 * @return #NOTIFICATION_ERROR_NONE on success,
332 * otherwise any other value on failure
333 * @retval #NOTIFICATION_ERROR_NONE Success
334 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
337 #include <notification.h>
340 notification_h noti = NULL;
341 int noti_err = NOTIFICATION_ERROR_NONE;
343 noti = notification_create(NOTIFICATION_TYPE_NOTI);
348 noti_err = notification_set_text_domain(noti, PACKAGE, LOCALEDIR);
349 if(noti_err != NOTIFICATION_ERROR_NONE) {
350 notification_free(noti);
356 int notification_set_text_domain(notification_h noti,
362 * @brief Gets the text domain from the notification handle.
364 * @remarks Do not free returned domain and dir. They are freed when notification_free() or notification_free_list() is called.
365 * @param[in] noti The notification handle
366 * @param[out] domain The domain
367 * @param[out] dir The locale dir
368 * @return #NOTIFICATION_ERROR_NONE on success,
369 * otherwise any other value on failure
370 * @retval #NOTIFICATION_ERROR_NONE Success
371 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
374 #include <notification.h>
377 notification_h noti = NULL;
378 int noti_err = NOTIFICATION_ERROR_NONE;
382 noti_err = notification_get_text_domain(noti, &domain, &dir);
383 if(noti_err != NOTIFICATION_ERROR_NONE) {
389 int notification_get_text_domain(notification_h noti,
394 * @brief Sets the sound type for the notification.
396 * @param[in] noti The notification handle
397 * @param[in] type The notification sound type
398 * @param[in] path The user sound file path
399 * @return #NOTIFICATION_ERROR_NONE on success,
400 * otherwise any other value on failure
401 * @retval #NOTIFICATION_ERROR_NONE Success
402 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
405 #include <notification.h>
408 notification_h noti = NULL;
409 int noti_err = NOTIFICATION_ERROR_NONE;
411 noti_err = notification_set_sound(noti, NOTIFICATION_SOUND_TYPE_DEFAULT, NULL);
412 if(noti_err != NOTIFICATION_ERROR_NONE) {
418 int notification_set_sound(notification_h noti,
419 notification_sound_type_e type,
423 * @brief Gets the sound type from the notification handle.
425 * @param[in] noti The notification handle
426 * @param[out] type The notification sound type
427 * @param[out] path The user sound file path
428 * @return #NOTIFICATION_ERROR_NONE on success,
429 * otherwise any other value on failure
430 * @retval #NOTIFICATION_ERROR_NONE Success
431 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
434 #include <notification.h>
437 notification_h noti = NULL;
438 int noti_err = NOTIFICATION_ERROR_NONE;
439 notification_sound_type_e type = NOTIFICATION_SOUND_TYPE_NONE;
441 noti_err = notification_get_sound(noti, &type, NULL);
442 if(noti_err != NOTIFICATION_ERROR_NONE) {
448 int notification_get_sound(notification_h noti,
449 notification_sound_type_e *type,
453 * @brief Sets the vibration type for the notification.
455 * @param[in] noti The notification handle
456 * @param[in] type The notification vibration type
457 * @param[in] path The user vibration file path
458 * @return #NOTIFICATION_ERROR_NONE on success,
459 * otherwise any other value on failure
460 * @retval #NOTIFICATION_ERROR_NONE Success
461 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
464 #include <notification.h>
467 notification_h noti = NULL;
468 int noti_err = NOTIFICATION_ERROR_NONE;
470 noti_err = notification_set_vibration(noti, NOTIFICATION_VIBRATION_TYPE_DEFAULT, NULL);
471 if(noti_err != NOTIFICATION_ERROR_NONE) {
477 int notification_set_vibration(notification_h noti,
478 notification_vibration_type_e type,
482 * @brief Gets the vibrate type from the notification handle.
484 * @param[in] noti The notification handle
485 * @param[out] type The notification sound type
486 * @param[out] path The user vibration file path
487 * @return #NOTIFICATION_ERROR_NONE on success,
488 * otherwise other value on failure
489 * @retval #NOTIFICATION_ERROR_NONE Success
490 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
493 #include <notification.h>
496 notification_h noti = NULL;
497 int noti_err = NOTIFICATION_ERROR_NONE;
498 notification_vibration_type_e type = NOTIFICATION_VIBRATION_TYPE_NONE;
500 noti_err = notification_get_vibration(noti, &type, NULL);
501 if(noti_err != NOTIFICATION_ERROR_NONE) {
507 int notification_get_vibration(notification_h noti,
508 notification_vibration_type_e *type,
512 * @brief Sets the LED displaying option.
514 * @param[in] noti The notification handle
515 * @param[in] operation The LED notification operation
516 * @param[in] led_argb The notification led color
517 * @return #NOTIFICATION_ERROR_NONE on success,
518 * otherwise other value on failure
519 * @retval #NOTIFICATION_ERROR_NONE Success
520 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
523 #include <notification.h>
526 notification_h noti = NULL;
527 int noti_err = NOTIFICATION_ERROR_NONE;
529 noti_err = notification_set_led(noti, NOTIFICATION_LED_TYPE_DEFAULT, NULL);
530 if(noti_err != NOTIFICATION_ERROR_NONE) {
536 int notification_set_led(notification_h noti,
537 notification_led_op_e operation,
541 * @brief Gets the LED displaying option from the notification handle.
543 * @param[in] noti The notification handle
544 * @param[out] operation The LED notification operation
545 * @param[out] led_argb The notification LED color
546 * @return #NOTIFICATION_ERROR_NONE on success,
547 * otherwise any other value on failure
548 * @retval #NOTIFICATION_ERROR_NONE Success
549 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
552 #include <notification.h>
555 notification_h noti = NULL;
556 int noti_err = NOTIFICATION_ERROR_NONE;
557 notification_led_type_e type = NOTIFICATION_LED_TYPE_NONE;
559 noti_err = notification_get_led(noti, &type, NULL);
560 if(noti_err != NOTIFICATION_ERROR_NONE) {
566 int notification_get_led(notification_h noti,
567 notification_led_op_e *operation,
571 * @brief Sets the time period of flashing the LED.
573 * @param[in] noti The notification handle
574 * @param[in] on_ms The time for turning on the LED
575 * @param[in] off_ms The time for turning off the LED
576 * @return #NOTIFICATION_ERROR_NONE on success,
577 * otherwise any other value on failure
578 * @retval #NOTIFICATION_ERROR_NONE Success
579 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
582 #include <notification.h>
585 notification_h noti = NULL;
586 int noti_err = NOTIFICATION_ERROR_NONE;
588 noti_err = notification_set_led_time_period(noti, 100, 100);
589 if(noti_err != NOTIFICATION_ERROR_NONE) {
595 int notification_set_led_time_period(notification_h noti,
596 int on_ms, int off_ms);
599 * @brief Gets the time period of flashing the LED from the notification handle.
601 * @param[in] noti The notification handle
602 * @param[out] on_ms The time for turning on the LED
603 * @param[out] off_ms The time for turning on the LED
604 * @return #NOTIFICATION_ERROR_NONE on success,
605 * otherwise any other value on failure
606 * @retval #NOTIFICATION_ERROR_NONE Success
607 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
610 #include <notification.h>
613 notification_h noti = NULL;
614 int noti_err = NOTIFICATION_ERROR_NONE;
618 noti_err = notification_get_led_time_period(noti, &led_on_ms, &led_off_ms);
619 if(noti_err != NOTIFICATION_ERROR_NONE) {
625 int notification_get_led_time_period(notification_h noti,
626 int *on_ms, int *off_ms);
629 * @brief Sets the launch option for a notification.
630 * @details When notification data selected in display application, application launched by app_control_send_launch_request with app_control handle.
632 * @param[in] noti The notification handle
633 * @param[in] type Launching option type
634 * @param[in] option App Control handler
635 * @return #NOTIFICATION_ERROR_NONE on success,
636 * otherwise any other value on failure
637 * @retval #NOTIFICATION_ERROR_NONE Success
638 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
641 #include <notification.h>
644 notification_h noti = NULL;
645 app_control_h app_control = NULL;
646 int noti_err = NOTIFICATION_ERROR_NONE;
650 app_control_create(&app_control);
651 app_control_set_app_id(app_control, "org.tizen.app");
655 noti_err = notification_set_launch_option(noti, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void *)app_control);
656 if(noti_err != NOTIFICATION_ERROR_NONE) {
657 notification_free(noti);
661 app_control_destroy(app_control);
665 int notification_set_launch_option(notification_h noti,
666 notification_launch_option_type type, void *option);
669 * @brief Gets the launch option from the notification handle.
671 * @remarks You must release @a app_control using app_control_destroy().
672 * @param[in] noti The notification handle
673 * @param[in] type Launching option type
674 * @param[out] option The pointer of App Control handler
675 * @return #NOTIFICATION_ERROR_NONE on success,
676 * otherwise any other value on failure
677 * @retval #NOTIFICATION_ERROR_NONE Success
678 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
681 #include <notification.h>
684 app_control_h app_control = NULL;
685 app_control_create(&app_control);
689 noti_err = notification_get_launch_option(noti, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void *)&app_control);
690 if(noti_err != NOTIFICATION_ERROR_NONE) {
691 notification_free(noti);
697 int notification_get_launch_option(notification_h noti,
698 notification_launch_option_type type, void *option);
702 * @brief Sets the handler for a specific event.
703 * @details When some event occurs on notification, application launched by app_control_send_launch_request with app_control handle.\n
704 * Setting event handler of a button means that the notification will show the button.
707 * @feature http://tizen.org/feature/notification
708 * @param[in] noti The notification handle
709 * @param[in] event_type event type
710 * @param[in] event_handler app control handle
711 * @return #NOTIFICATION_ERROR_NONE on success,
712 * otherwise any other value on failure
713 * @retval #NOTIFICATION_ERROR_NONE Success
714 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
715 * @see #notification_event_type_e
718 #include <notification.h>
721 notification_h noti = NULL;
722 app_control_h app_control = NULL;
723 int noti_err = NOTIFICATION_ERROR_NONE;
727 app_control_create(&app_control);
728 app_control_set_app_id(app_control, "org.tizen.app");
732 noti_err = notification_set_event_handler(noti, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, app_control);
733 if(noti_err != NOTIFICATION_ERROR_NONE) {
734 notification_free(noti);
738 app_control_destroy(app_control);
742 int notification_set_event_handler(notification_h noti, notification_event_type_e event_type, app_control_h event_handler);
745 * @brief Gets the event handler of a specific event.
746 * @remarks You must release @a app_control using app_control_destroy().
749 * @feature http://tizen.org/feature/notification
750 * @param[in] noti The notification handle
751 * @param[in] event_type Launching option type
752 * @param[out] option The pointer of App Control handler
753 * @return #NOTIFICATION_ERROR_NONE on success,
754 * otherwise any other value on failure
755 * @retval #NOTIFICATION_ERROR_NONE Success
756 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
757 * @see #notification_event_type_e
760 #include <notification.h>
763 app_control_h app_control = NULL;
764 app_control_create(&app_control);
768 noti_err = notification_get_event_handler(noti, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, &app_control);
769 if(noti_err != NOTIFICATION_ERROR_NONE) {
770 notification_free(noti);
776 int notification_get_event_handler(notification_h noti, notification_event_type_e event_type, app_control_h *event_handler);
779 * @brief Sets the property of the notification.
781 * @param[in] noti The notification handle
782 * @param[in] flags The property with | operation
783 * @return #NOTIFICATION_ERROR_NONE on success,
784 * otherwise any other value on failure
785 * @retval #NOTIFICATION_ERROR_NONE Success
786 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
789 #include <notification.h>
792 notification_h noti = NULL;
793 int noti_err = NOTIFICATION_ERROR_NONE;
796 noti = notification_create(NOTIFICATION_TYPE_NOTI);
801 noti_err = notification_set_property(noti, NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE | NOTIFICATION_PROP_DISABLE_APP_LAUNCH);
802 if(noti_err != NOTIFICATION_ERROR_NONE) {
803 notification_free(noti);
809 int notification_set_property(notification_h noti,
813 * @brief Gets the property of the notification from the notification handle.
815 * @param[in] noti The notification handle
816 * @param[out] flags The notification property
817 * @return #NOTIFICATION_ERROR_NONE on success,
818 * otherwise any other value on failure
819 * @retval #NOTIFICATION_ERROR_NONE Success
820 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
823 #include <notification.h>
826 notification_h noti = NULL;
827 int noti_err = NOTIFICATION_ERROR_NONE;
830 noti_err = notification_get_property(noti, &flags);
831 if(noti_err != NOTIFICATION_ERROR_NONE) {
837 int notification_get_property(notification_h noti,
841 * @brief Sets applications to display the notification.
842 * @details All display application is enable(NOTIFICATION_DISPLAY_APP_ALL) if you are not call this API.
844 * @param[in] noti The notification handle
845 * @param[in] applist The with | operation
846 * @return #NOTIFICATION_ERROR_NONE on success,
847 * otherwise any other value on failure
848 * @retval #NOTIFICATION_ERROR_NONE Success
849 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
852 #include <notification.h>
855 notification_h noti = NULL;
856 int noti_err = NOTIFICATION_ERROR_NONE;
859 noti = notification_create(NOTIFICATION_TYPE_NOTI);
864 noti_err = notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_TICKER);
865 if(noti_err != NOTIFICATION_ERROR_NONE) {
866 notification_free(noti);
873 int notification_set_display_applist(notification_h noti,
877 * @brief Gets the application list displaying the notification from the notification handle.
879 * @param[in] noti The notification handle
880 * @param[out] applist The display application list
881 * @return #NOTIFICATION_ERROR_NONE on success,
882 * otherwise any other value on failure
883 * @retval #NOTIFICATION_ERROR_NONE Success
884 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
887 #include <notification.h>
890 notification_h noti = NULL;
891 int noti_err = NOTIFICATION_ERROR_NONE;
894 noti_err = notification_get_display_applist(noti, &applist);
895 if(noti_err != NOTIFICATION_ERROR_NONE) {
901 int notification_get_display_applist(notification_h noti,
905 * @brief Sets the initial size for the ongoing type.
906 * @details After notification_post() call, the size is not updated.
908 * @param[in] noti The notification handle
909 * @param[in] size The double type size
910 * @return #NOTIFICATION_ERROR_NONE on success,
911 * otherwise any other value on failure
912 * @retval #NOTIFICATION_ERROR_NONE Success
913 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
916 #include <notification.h>
919 notification_h noti = NULL;
920 int noti_err = NOTIFICATION_ERROR_NONE;
922 noti = notification_create(NOTIFICATION_TYPE_NOTI);
927 noti_err = notification_set_size(noti, 0.0);
928 if(noti_err != NOTIFICATION_ERROR_NONE) {
929 notification_free(noti);
935 int notification_set_size(notification_h noti,
939 * @brief Gets the progress size.
941 * @param[in] noti The notification handle
942 * @param[out] size The progress size
943 * @return #NOTIFICATION_ERROR_NONE on success,
944 * otherwise any other value on failure
945 * @retval #NOTIFICATION_ERROR_NONE Success
946 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
949 #include <notification.h>
952 notification_h noti = NULL;
953 int noti_err = NOTIFICATION_ERROR_NONE;
956 noti_err = notification_get_size(noti, &size);
957 if(noti_err != NOTIFICATION_ERROR_NONE) {
963 int notification_get_size(notification_h noti,
967 * @brief Sets the initial progress for the ongoing type.
968 * @details After the notification_post() call, the progress is not updated.
970 * @param[in] noti The notification handle
971 * @param[in] percentage The progress percentage
972 * @return #NOTIFICATION_ERROR_NONE on success,
973 * otherwise any other value on failure
974 * @retval #NOTIFICATION_ERROR_NONE Success
975 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
978 #include <notification.h>
981 notification_h noti = NULL;
982 int noti_err = NOTIFICATION_ERROR_NONE;
984 noti = notification_create(NOTIFICATION_TYPE_NOTI);
989 noti_err = notification_set_progress(noti, 0.0);
990 if(noti_err != NOTIFICATION_ERROR_NONE) {
991 notification_free(noti);
997 int notification_set_progress(notification_h noti,
1001 * @brief Gets the progress from the notification handle.
1003 * @remarks At the end of the operation, the progress should be @c 1.0.
1004 * @param[in] noti The notification handle
1005 * @param[out] percentage The progress percentage
1006 * @return #NOTIFICATION_ERROR_NONE on success,
1007 * otherwise any other value on failure
1008 * @retval #NOTIFICATION_ERROR_NONE Success
1009 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1012 #include <notification.h>
1015 notification_h noti = NULL;
1016 int noti_err = NOTIFICATION_ERROR_NONE;
1017 double percentage = 0.0;
1019 noti_err = notification_get_progress(noti, &percentage);
1020 if(noti_err != NOTIFICATION_ERROR_NONE) {
1026 int notification_get_progress(notification_h noti,
1027 double *percentage);
1030 * @brief Sets the layout of the notification view.
1031 * @details Caller can set displaying layout of notification.
1033 * @param[in] noti The notification handle
1034 * @param[in] layout The type of layout
1035 * @return #NOTIFICATION_ERROR_NONE on success,
1036 * otherwise any other value on failure
1037 * @retval #NOTIFICATION_ERROR_NONE Success
1038 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1039 * @see #notification_ly_type_e
1041 int notification_set_layout(notification_h noti,
1042 notification_ly_type_e layout);
1045 * @brief Gets the layout of the notification view from the notification handle.
1047 * @param[in] noti The notification handle
1048 * @param[out] layout The type of layout
1049 * @return #NOTIFICATION_ERROR_NONE on success,
1050 * otherwise any other value on failure
1051 * @retval #NOTIFICATION_ERROR_NONE Success
1052 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1053 * @see #notification_ly_type_e
1055 int notification_get_layout(notification_h noti,
1056 notification_ly_type_e *layout);
1059 * @brief Gets the type of a notification.
1061 * @param[in] noti The notification handle
1062 * @param[out] type The notification type
1063 * @return #NOTIFICATION_ERROR_NONE on success,
1064 * otherwise any other value on failure
1065 * @retval #NOTIFICATION_ERROR_NONE Success
1066 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1069 #include <notification.h>
1072 int noti_err = NOTIFICATION_ERROR_NONE;
1073 notification_type_e type;
1075 noti_err = notification_get_type(noti, &type);
1076 if(noti_err != NOTIFICATION_ERROR_NONE) {
1082 int notification_get_type(notification_h noti,
1083 notification_type_e * type);
1087 * @brief Inserts a notification.
1088 * @details The notification will be inserted to the database and then it will appear in the notification area.
1089 * When notification_create() is called, if priv_id is #NOTIFICATION_PRIV_ID_NONE, priv_id returns the internally set priv_id.
1092 * @privilege %http://tizen.org/privilege/notification
1093 * @param[in] noti The notification handle
1094 * @param[out] priv_id The private ID
1095 * @return #NOTIFICATION_ERROR_NONE on success,
1096 * otherwise any other value on failure
1097 * @retval #NOTIFICATION_ERROR_NONE Success
1098 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1099 * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1100 * @pre Notification handle should be created by notification_create().
1101 * @post notification_free().
1104 #include <notification.h>
1107 int noti_err = NOTIFICATION_ERROR_NONE;
1109 noti_err = notification_insert(noti, NULL);
1110 if(noti_err != NOTIFICATION_ERROR_NONE) {
1116 int notification_insert(notification_h noti,
1120 * @brief Updates notification data.
1121 * @details The updated notification will appear in the notification area.
1124 * @privilege %http://tizen.org/privilege/notification
1125 * @param[in] noti The notification handle that is created by notification_create()
1126 * @return #NOTIFICATION_ERROR_NONE on success,
1127 * otherwise any other value on failure
1128 * @retval #NOTIFICATION_ERROR_NONE Success
1129 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1130 * @retval #NOTIFICATION_ERROR_NOT_EXIST_ID Priv ID does not exist
1131 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1134 #include <notification.h>
1137 int noti_err = NOTIFICATION_ERROR_NONE;
1139 noti_err = notification_update(NULL);
1140 if(noti_err != NOTIFICATION_ERROR_NONE) {
1146 int notification_update(notification_h noti);
1150 * @brief Updates a notification, asynchronously.
1151 * @details The updated notification will appear in the notification area.
1154 * @privilege %http://tizen.org/privilege/notification
1155 * @remarks This function updates the notification asynchronously.
1156 * @param[in] noti The notification handle that is created by notification_create()
1157 * @param[in] result_cb The callback called when an update completed
1158 * @param[in] user_data The user data which you want to use in callback
1159 * @return #NOTIFICATION_ERROR_NONE on success,
1160 * otherwise any other value on failure
1161 * @retval #NOTIFICATION_ERROR_NONE Success
1162 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1163 * @retval #NOTIFICATION_ERROR_NOT_EXIST_ID Priv ID does not exist
1164 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1167 #include <notification.h>
1170 int noti_err = NOTIFICATION_ERROR_NONE;
1172 noti_err = notification_update_async(NULL, result_cb, data);
1173 if(noti_err != NOTIFICATION_ERROR_NONE) {
1179 int notification_update_async(notification_h noti,
1180 void (*result_cb)(int priv_id, int result, void *data), void *user_data);
1183 * @brief Deletes a notification with the given handle.
1184 * @details notification_delete() removes notification data from database and notification_free() releases memory of notification data.
1187 * @privilege %http://tizen.org/privilege/notification
1188 * @param[in] noti The notification handle
1189 * @return #NOTIFICATION_ERROR_NONE on success,
1190 * otherwise any other value on failure
1191 * @retval #NOTIFICATION_ERROR_NONE Success
1192 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1193 * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1196 #include <notification.h>
1199 notificaton_h noti = NULL;
1200 int noti_err = NOTIFICATION_ERROR_NONE;
1204 noti_err = notification_delete(noti);
1205 if(noti_err != NOTIFICATION_ERROR_NONE) {
1212 int notification_delete(notification_h noti);
1215 * @brief Creates internal structure data and returns a notification handle.
1216 * @details Available type is #NOTIFICATION_TYPE_NOTI and #NOTIFICATION_TYPE_ONGOING.
1217 * #NOTIFICATION_TYPE_NOTI is remaining notification data even if device is restarted.
1218 * #NOTIFICATION_TYPE_ONGOING can display progressive feather, but notification data is removed after device is restarted.
1220 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1221 * @param[in] type The notification type
1222 * @return Notification handle(notification_h) on success,
1223 * otherwise @c NULL on failure
1224 * @retval notification_h Success
1225 * @retval NULL Failure
1226 * @exception #NOTIFICATION_ERROR_NONE Success
1227 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1228 * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1229 * @see #notification_type_e
1232 #include <notification.h>
1235 notification_h noti = NULL;
1237 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1245 notification_h notification_create(notification_type_e type);
1248 * @brief Creates a notification clone.
1249 * @details Newly created notification handle is returned.
1251 * @remarks This cloned notification handle should be freed using notification_free().
1252 * @param[in] noti The notification handle
1253 * @param[out] clone The newly created notification handle that has same with input @a noti
1254 * @return #NOTIFICATION_ERROR_NONE if success,
1255 * otherwise any other value if failure
1256 * @retval #NOTIFICATION_ERROR_NONE Success
1257 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1258 * @see #notification_type_e
1261 #include <notification.h>
1264 notification_h noti = notification_create(NOTIFICATION_TYPE_NOTI);
1265 notification_h clone = NULL;
1267 notification_clone(noti, &clone);
1272 int notification_clone(notification_h noti, notification_h *clone);
1275 * @brief Frees the internal structure data of a notification handle.
1276 * @details Internal data of a notification handle is released. Data of the inserted notification is not deleted.
1278 * @param[in] noti The notification handle
1279 * @return #NOTIFICATION_ERROR_NONE on success,
1280 * otherwise any other value on failure
1281 * @retval #NOTIFICATION_ERROR_NONE Success
1282 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1283 * @pre Notification handle should be created by notification_create().
1286 #include <notification.h>
1289 notification_h noti = NULL;
1290 int noti_err = NOTIFICATION_ERROR_NONE;
1292 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1298 noti_err = notification_free(noti);
1299 if(noti_err != NOTIFICATION_ERROR_NONE) {
1305 int notification_free(notification_h noti);
1313 * @addtogroup NOTIFICATION_LIST
1319 * @brief Returns the notification list handle.
1320 * @details If count is equal to @c -1, all notifications are returned.
1323 * @privilege %http://tizen.org/privilege/notification
1324 * @param[in] type The notification type
1325 * @param[in] count The returned notification data number
1326 * @param[out] #NOTIFICATION_ERROR_NONE on success, other value on failure
1327 * @return #NOTIFICATION_ERROR_NONE on success,
1328 * otherwise any other value on failure
1329 * @retval #NOTIFICATION_ERROR_NONE Success
1330 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1331 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1332 * @see #notification_list_h
1335 #include <notification.h>
1338 notification_list_h noti_list = NULL;
1339 int noti_err = NOTIFICATION_ERROR_NONE;
1341 noti_err = notification_get_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list);
1342 if(noti_err != NOTIFICATION_ERROR_NONE) {
1348 int notification_get_list(notification_type_e type,
1350 notification_list_h * list);
1354 * @brief Returns the notification detail list handle of grouping data.
1355 * @details If count is equal to c -1, all notifications are returned.
1358 * @privilege %http://tizen.org/privilege/notification
1359 * @param[in] pkgname The caller application package name
1360 * @param[in] group_id The group ID
1361 * @param[in] priv_id The private ID
1362 * @param[in] count The returned notification data number
1363 * @param[out] list The notification list handle
1364 * @return #NOTIFICATION_ERROR_NONE if success,
1365 * other value if failure
1366 * @retval #NOTIFICATION_ERROR_NONE Success
1367 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1368 * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1369 * @see #notification_list_h
1372 #include <notification.h>
1375 notification_list_h noti_list = NULL;
1376 int noti_err = NOTIFICATION_ERROR_NONE;
1378 noti_err = notification_get_detail_list(pkgname, group_id, priv_id, -1, ¬i_list);
1379 if(noti_err != NOTIFICATION_ERROR_NONE) {
1385 int notification_get_detail_list(const char *pkgname,
1389 notification_list_h *list);
1393 * @brief Frees a notification list.
1396 * @privilege %http://tizen.org/privilege/notification
1397 * @param[in] list The notification list handle
1398 * @return #NOTIFICATION_ERROR_NONE on success,
1399 * otherwise any other value on failure
1400 * @retval #NOTIFICATION_ERROR_NONE Success
1401 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1402 * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1403 * @pre notification_get_grouping_list() or notification_get_detail_list().
1404 * @see #notification_list_h
1407 #include <notification.h>
1410 notification_list_h noti_list = NULL;
1411 int noti_err = NOTIFICATION_ERROR_NONE;
1415 noti_err = notification_free_list(noti_list);
1416 if(noti_err != NOTIFICATION_ERROR_NONE) {
1422 int notification_free_list(notification_list_h list);
1429 * @addtogroup NOTIFICATION_MODULE
1435 * @brief Registers a callback for all notification events.
1436 * @details The registered callback could be called for all notification events.
1439 * @privilege %http://tizen.org/privilege/notification
1440 * @param[in] changed_cb The callback function
1441 * @param[in] user_data The user data
1442 * @return #NOTIFICATION_ERROR_NONE on success,
1443 * otherwise any other value on failure
1444 * @retval #NOTIFICATION_ERROR_NONE Success
1445 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1446 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1447 * @see notification_unregister_detailed_changed_cb()
1450 #include <notification.h>
1453 noti_err = notification_register_detailed_changed_cb(app_changed_cb, user_data);
1454 if(noti_err != NOTIFICATION_ERROR_NONE) {
1460 int notification_register_detailed_changed_cb(
1461 void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
1466 * @brief Unregisters a callback for all notification events.
1469 * @privilege %http://tizen.org/privilege/notification
1470 * @param[in] changed_cb The callback function
1471 * @return #NOTIFICATION_ERROR_NONE on success,
1472 * otherwise any other value on failure
1473 * @retval #NOTIFICATION_ERROR_NONE Success
1474 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1475 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1476 * @see notification_register_detailed_changed_cb()
1479 #include <notification.h>
1482 noti_err = notification_register_detailed_changed_cb(app_changed_cb, user_data);
1483 if(noti_err != NOTIFICATION_ERROR_NONE) {
1489 int notification_unregister_detailed_changed_cb(
1490 void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
1494 * @brief Sets the tag of the notification handle.
1496 * @param[in] noti Notification handle
1497 * @param[in] tag tag for loading notification handle
1498 * @return #NOTIFICATION_ERROR_NONE on success, other value on failure
1499 * @retval #NOTIFICATION_ERROR_NONE Success
1500 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1501 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1502 * @see notification_get_tag()
1505 #include <notification.h>
1508 notification_h noti = NULL;
1509 int noti_err = NOTIFICATION_ERROR_NONE;
1511 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1517 noti_err = notification_set_tag(noti, tag);
1518 if(noti_err != NOTIFICATION_ERROR_NONE) {
1524 int notification_set_tag(notification_h noti, const char *tag);
1527 * @brief Gets the tag of the notification handle.
1529 * @param[in] noti Notification handle
1530 * @param[out] tag tag for loading notification handle
1531 * @return #NOTIFICATION_ERROR_NONE on success, other value on failure
1532 * @retval #NOTIFICATION_ERROR_NONE Success
1533 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1534 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1535 * @see notification_set_tag()
1538 #include <notification.h>
1541 int noti_err = NOTIFICATION_ERROR_NONE;
1542 const char *tag = NULL;
1546 noti_err = notification_get_tag(noti, &tag);
1547 if(noti_err != NOTIFICATION_ERROR_NONE) {
1553 int notification_get_tag(notification_h noti, const char **tag);
1556 * @brief Gets the package name of the notification
1559 * @param[in] noti Notification handle
1560 * @param[out] pkgname package name of the notification
1561 * @return NOTIFICATION_ERROR_NONE on success, other value on failure
1562 * @retval NOTIFICATION_ERROR_NONE Success
1563 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1566 #include <notification.h>
1569 notification_h noti = NULL;
1570 int noti_err = NOTIFICATION_ERROR_NONE;
1571 char *pkgname = NULL;
1573 noti_err = notification_get_pkgname(noti, &pkgname);
1574 if(noti_err != NOTIFICATION_ERROR_NONE) {
1580 int notification_get_pkgname(notification_h noti, char **pkgname);
1583 * @brief Loads a notification from the notification's database with the tag.
1586 * @privilege %http://tizen.org/privilege/notification
1587 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1588 * @param[in] tag tag for loading notification handle
1589 * @return Notification handle(notification_h) on success, NULL on failure
1590 * @retval notification_h Success
1591 * @retval NULL Failure
1592 * @exception #NOTIFICATION_ERROR_NONE Success
1593 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1594 * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1595 * @exception #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1596 * @see #notification_type_e
1599 #include <notification.h>
1602 notification_h noti = NULL;
1604 noti = notification_load_by_tag(tag);
1612 notification_h notification_load_by_tag(const char *tag);
1615 * @brief Deletes all notifications of the given type.
1618 * @privilege %http://tizen.org/privilege/notification
1619 * @param[in] type Notification type
1620 * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
1621 * @retval #NOTIFICATION_ERROR_NONE Success
1622 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1623 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1626 #include <notification.h>
1629 int noti_err = NOTIFICATION_ERROR_NONE;
1631 noti_err = notification_delete_all(NOTIFICATION_TYPE_NOTI);
1632 if(noti_err != NOTIFICATION_ERROR_NONE) {
1638 int notification_delete_all(notification_type_e type);
1641 * @brief Posts a notification.
1644 * @privilege %http://tizen.org/privilege/notification
1645 * @param[in] noti Notification handle
1646 * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
1647 * @retval #NOTIFICATION_ERROR_NONE Success
1648 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1649 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1650 * @pre Notification handle should be created by notification_create().
1651 * @post notification_free().
1654 #include <notification.h>
1657 int noti_err = NOTIFICATION_ERROR_NONE;
1659 noti_err = notification_post(noti);
1660 if(noti_err != NOTIFICATION_ERROR_NONE) {
1666 int notification_post(notification_h noti);
1675 #endif /* __NOTIFICATION_H__ */